"""Test LLM API call.""" import asyncio from config.config_loader import load_config import httpx async def test_llm_call(): """Test LLM API call with a simple prompt.""" config = load_config() llm_config = config["llm"] headers = { "Authorization": f"Bearer {llm_config['api_key']}", "Content-Type": "application/json" } # Deepseek chat completion payload payload = { "model": llm_config["model"], "messages": [ {"role": "user", "content": "Say hello and introduce yourself in one sentence."} ], "temperature": llm_config["temperature"], "max_tokens": llm_config["max_tokens"] } print("Making API call to Deepseek...") print(f"Base URL: {llm_config['api_base']}") print(f"Model: {llm_config['model']}") async with httpx.AsyncClient() as client: try: response = await client.post( f"{llm_config['api_base']}/v1/chat/completions", headers=headers, json=payload, timeout=llm_config["timeout"] ) response.raise_for_status() result = response.json() print("\nResponse:") print(result["choices"][0]["message"]["content"]) except httpx.HTTPStatusError as e: print(f"HTTP error occurred: {e.response.text}") except Exception as e: print(f"An error occurred: {str(e)}") if __name__ == "__main__": asyncio.run(test_llm_call())