""" Orchestration Tests: Role Mapping Tests that the correct model is selected for each role. Updated to match current LLMClient architecture. """ import pytest from app.core.model_registry import model_registry @pytest.mark.asyncio async def test_model_registry_has_roles(): """ Validates that the model registry has preferred models for each role. """ # Check registry returns valid models for each role fast = model_registry.get_preferred_model("groq", "FAST_CHAT") smart = model_registry.get_preferred_model("groq", "SMART_REASONING") structured = model_registry.get_preferred_model("groq", "STRUCTURED_OUTPUT") assert fast is not None assert smart is not None assert structured is not None # Models should be strings assert isinstance(fast, str) assert isinstance(smart, str) assert isinstance(structured, str) @pytest.mark.asyncio async def test_fallback_chain_exists(): """ Validates that fallback chains are properly configured. """ # Get fallback chain for structured output chain = model_registry.get_fallback_chain("groq", "STRUCTURED_OUTPUT") assert chain is not None assert len(chain) > 0 assert isinstance(chain, list) @pytest.mark.asyncio async def test_model_capabilities_defined(): """ Validates that models have capabilities defined in registry. """ from app.core.model_registry import Capability # Verify MODELS dict is populated assert len(model_registry.MODELS) > 0 # At least one model should support JSON json_models = [m for m in model_registry.MODELS if model_registry.supports(m, Capability.JSON_OBJECT)] assert len(json_models) > 0