import sys
import json
import asyncio
import aiohttp
import uuid

# Load credentials
with open("/home/stuart/.archie/credentials.json") as f:
    token = json.load(f)["access_token"]

async def test_query():
    headers = {
        "Authorization": f"Bearer {token}",
        "Content-Type": "application/json"
    }
    
    payload = {
        "query_text": "What is 2+2?",
        "conversation_id": f"test-{uuid.uuid4()}"
    }
    
    async with aiohttp.ClientSession() as session:
        async with session.post(
            "http://localhost:5050/api/v1/query/mock",
            headers=headers,
            json=payload
        ) as response:
            result = await response.json()
            print(json.dumps(result, indent=2))

asyncio.run(test_query())
