#!/usr/bin/env python3 """Test that we can actually query a model and get a response.""" import asyncio import sys sys.path.insert(0, '.') from backend.llm_client import query_model from backend.config import COUNCIL_MODELS async def test_query(): """Test querying one of the council models.""" if not COUNCIL_MODELS: print("✗ No council models configured") return False test_model = COUNCIL_MODELS[0] print(f"Testing query to model: {test_model}") print("-" * 60) try: response = await query_model( model=test_model, messages=[{"role": "user", "content": "Say 'Hello, GPU Ollama is working!' in one sentence."}], max_tokens_override=50, # Short response for quick test timeout=30.0 ) if response and response.get('content'): content = response['content'].strip() print(f"✓ Query successful!") print(f"\nResponse:") print(f" {content}") return True else: print(f"✗ Query returned no content") print(f"Response: {response}") return False except Exception as e: print(f"✗ Query failed: {type(e).__name__}: {e}") import traceback traceback.print_exc() return False if __name__ == "__main__": success = asyncio.run(test_query()) sys.exit(0 if success else 1)