Spaces:
Running
Running
| import httpx | |
| import asyncio | |
| API_URL = "http://127.0.0.1:7860/api/rag/query" | |
| TEST_QUERIES = [ | |
| "What health schemes are available in Maharashtra?", | |
| "Education scholarships for SC students in Tamil Nadu", | |
| "MGNREGA wage rate 2024", | |
| "PM Awas Yojana eligibility", | |
| "Agricultural subsidy for small farmers in Punjab" | |
| ] | |
| async def run_tests(): | |
| async with httpx.AsyncClient(timeout=60.0) as client: | |
| for q in TEST_QUERIES: | |
| print(f"\n{'='*50}\n🧪 Testing: {q}\n{'-'*50}") | |
| resp = await client.post(API_URL, json={"question": q, "language": "english"}) | |
| if resp.status_code == 200: | |
| print(resp.text) | |
| print(f"\n📚 Sources: {resp.headers.get('X-Sources', 'None')}") | |
| else: | |
| print(f"❌ Error: {resp.status_code} - {resp.text}") | |
| if __name__ == "__main__": | |
| asyncio.run(run_tests()) |