Spaces:
Running
on
Zero
Running
on
Zero
| # Test the Warbler CDA API | |
| Write-Host "π§ͺ Testing Warbler CDA FractalStat API" -ForegroundColor Green | |
| Write-Host "======================================" -ForegroundColor Green | |
| Write-Host "" | |
| # Test health endpoint | |
| Write-Host "1. Testing health endpoint..." -ForegroundColor Cyan | |
| try { | |
| $healthResponse = Invoke-RestMethod -Uri "http://localhost:8000/health" -Method GET | |
| Write-Host " β Health check passed:" -ForegroundColor Green | |
| Write-Host " $($healthResponse | ConvertTo-Json -Depth 2)" -ForegroundColor Gray | |
| } catch { | |
| Write-Host " β Health check failed: $($_.Exception.Message)" -ForegroundColor Red | |
| } | |
| Write-Host "" | |
| # Test API docs endpoint | |
| Write-Host "2. Testing API docs endpoint..." -ForegroundColor Cyan | |
| try { | |
| $docsResponse = Invoke-WebRequest -Uri "http://localhost:8000/docs" -Method GET | |
| if ($docsResponse.StatusCode -eq 200) { | |
| Write-Host " β API docs accessible at http://localhost:8000/docs" -ForegroundColor Green | |
| } | |
| } catch { | |
| Write-Host " β API docs not accessible: $($_.Exception.Message)" -ForegroundColor Red | |
| } | |
| Write-Host "" | |
| # Test query endpoint with simple request | |
| Write-Host "3. Testing query endpoint..." -ForegroundColor Cyan | |
| $queryBody = @{ | |
| query_id = "test_query_001" | |
| mode = "semantic_similarity" | |
| semantic_query = "test query for fractalstat system" | |
| max_results = 5 | |
| confidence_threshold = 0.5 | |
| fractalstat_hybrid = $false | |
| weight_semantic = 0.7 | |
| weight_fractalstat = 0.3 | |
| } | ConvertTo-Json | |
| Write-Host " Sending request with body:" -ForegroundColor Gray | |
| Write-Host " $queryBody" -ForegroundColor Gray | |
| try { | |
| $queryResponse = Invoke-RestMethod -Uri "http://localhost:8000/query" -Method POST -Body $queryBody -ContentType "application/json" | |
| Write-Host "" | |
| Write-Host " β Query completed successfully!" -ForegroundColor Green | |
| Write-Host " Results: $($queryResponse.result_count) results returned" -ForegroundColor Green | |
| # Show some details | |
| if ($queryResponse.results) { | |
| Write-Host " Sample result:" -ForegroundColor Gray | |
| Write-Host " - Content: $($queryResponse.results[0].content)" -ForegroundColor Gray | |
| Write-Host " - Relevance: $($queryResponse.results[0].relevance_score)" -ForegroundColor Gray | |
| } | |
| } catch { | |
| Write-Host "" | |
| Write-Host " β Query failed: $($_.Exception.Message)" -ForegroundColor Red | |
| Write-Host " This is expected if no data is loaded - the API is working!" -ForegroundColor Yellow | |
| } | |
| Write-Host "" | |
| Write-Host "π― API Status: RUNNING AND ACCESSIBLE!" -ForegroundColor Green | |
| Write-Host "" | |
| Write-Host "π Full documentation: http://localhost:8000/docs" -ForegroundColor Cyan | |
| Write-Host "π Interactive API testing: Use the Swagger UI above" -ForegroundColor Cyan | |