from abc import ABC, abstractmethod from app.schemas.chat import ChatMessage class AIProvider(ABC): provider_name: str = "unknown" model_name: str = "unknown" @abstractmethod async def chat( self, messages: list[ChatMessage], max_tokens: int, temperature: float, ) -> tuple[str, int | None, int | None]: """ Send messages to the provider and return (content, input_tokens, output_tokens). Raises: ProviderConnectionError: on network / auth failure ProviderTimeoutError: on request timeout """ ...