"""Abstract base class for AI providers.""" from __future__ import annotations from abc import ABC, abstractmethod from collections.abc import AsyncIterator from typing import Any class AIProvider(ABC): """Base interface for all AI providers.""" @abstractmethod async def chat(self, messages: list[dict[str, Any]], config: dict[str, Any]) -> str: """Send a chat completion request and return the response.""" ... @abstractmethod async def stream( self, messages: list[dict[str, Any]], config: dict[str, Any] ) -> AsyncIterator[str]: """Send a streaming chat request, yielding tokens as they arrive.""" ...