| from abc import ABC, abstractmethod | |
| from typing import TypeVar, Type | |
| from pydantic import BaseModel | |
| T = TypeVar('T', bound=BaseModel) | |
| class LLMProvider(ABC): | |
| async def generate_structured( | |
| self, | |
| prompt: str, | |
| response_schema: Type[T], | |
| temperature: float = 0.1, | |
| ) -> T: | |
| """Generate structured output validated against a Pydantic schema.""" | |
| pass | |
| async def generate_text( | |
| self, | |
| prompt: str, | |
| temperature: float = 0.3, | |
| ) -> str: | |
| """Generate free-form text.""" | |
| pass | |