"""Routes for listing available models and agents.""" from fastapi import APIRouter, Depends from core.security import get_current_user from domain.models import ModelsListResponse, AgentsListResponse, ModelInfo, AgentInfo from services.llm_service import llm_service from services.agent_registry import agent_registry router = APIRouter(tags=["Models & Agents"]) @router.get("/models", response_model=ModelsListResponse) async def list_models( current_user: dict = Depends(get_current_user) ) -> ModelsListResponse: """ List all available LLM models. Returns information about all supported models from OpenAI and Mistral AI, including their capabilities and context windows. Args: current_user: Authenticated user (JWT required) Returns: List of available models with metadata """ models_data = llm_service.list_available_models() models = [ModelInfo(**model) for model in models_data] return ModelsListResponse( models=models, total=len(models) ) @router.get("/agents", response_model=AgentsListResponse) async def list_agents( current_user: dict = Depends(get_current_user) ) -> AgentsListResponse: """ List all available agent types. Returns information about all registered agent types and their availability. Args: current_user: Authenticated user (JWT required) Returns: List of available agents with metadata """ agents_data = agent_registry.list_agents() agents = [AgentInfo(**agent) for agent in agents_data] return AgentsListResponse( agents=agents, total=len(agents) ) @router.get("/health") async def health_check(): """ Health check endpoint (no authentication required). Returns: API health status """ from config import settings from datetime import datetime return { "status": "healthy", "version": settings.api_version, "title": settings.api_title, "environment": settings.environment, "timestamp": datetime.utcnow().isoformat() }