import asyncio import httpx import json async def test(): async with httpx.AsyncClient(timeout=10) as client: resp = await client.get( "http://8.147.104.190:8001/api/agent/search", params={ "q": "科幻", "source_type": "实质", "entity_type": "all", "top_k": 2, "use_description": "true", } ) data = resp.json() with open("test_api_output.json", "w", encoding="utf-8") as f: json.dump(data, f, ensure_ascii=False, indent=2) asyncio.run(test())