#!/usr/bin/env python3 """ Test script for LLM router. """ import sys from pathlib import Path # Add parent directory to path sys.path.insert(0, str(Path(__file__).parent.parent)) from routing.router import get_router def test_routing(): """Test routing logic.""" print("=" * 60) print("LLM Router Test") print("=" * 60) router = get_router() # Test explicit routing print("\n1. Testing explicit routing...") routing = router.route_request(agent_type="work") print(f" ✅ Work agent: {routing.agent_type} - {routing.reason}") print(f" URL: {routing.config.base_url}") print(f" Model: {routing.config.model_name}") routing = router.route_request(agent_type="family") print(f" ✅ Family agent: {routing.agent_type} - {routing.reason}") print(f" URL: {routing.config.base_url}") print(f" Model: {routing.config.model_name}") # Test client type routing print("\n2. Testing client type routing...") routing = router.route_request(client_type="desktop") print(f" ✅ Desktop client → {routing.agent_type} - {routing.reason}") routing = router.route_request(client_type="phone") print(f" ✅ Phone client → {routing.agent_type} - {routing.reason}") # Test default routing print("\n3. Testing default routing...") routing = router.route_request() print(f" ✅ Default → {routing.agent_type} - {routing.reason}") # Test health check print("\n4. Testing health checks...") work_healthy = router.health_check("work") print(f" ✅ Work agent health: {'Healthy' if work_healthy else 'Unhealthy'}") family_healthy = router.health_check("family") print(f" ⚠️ Family agent health: {'Healthy' if family_healthy else 'Unhealthy (expected - server not set up)'}") print("\n" + "=" * 60) print("✅ Routing tests complete!") print("=" * 60) if __name__ == "__main__": test_routing()