"""LLM service models."""

from typing import Any

from pydantic import BaseModel, Field


class LLMRequest(BaseModel):
    """Input parameters for LLM completion request."""

    messages: list[dict[str, str]]
    model: str = Field(default="gpt-4o-mini", description="Model identifier")
    temperature: float = Field(default=0.7, ge=0.0, le=2.0)
    max_tokens: int | None = Field(default=None, gt=0)
    timeout: int = Field(default=30, gt=0)
    max_retries: int = Field(default=0, ge=0)
    response_format: dict[str, Any] | None = Field(default=None)
    api_base: str | None = Field(default=None)


class LLMResponse(BaseModel):
    """Structured output from LLM completion."""

    content: str = Field(..., description="Raw text content from LLM")
    parsed_content: Any | None = Field(default=None, description="Parsed JSON if applicable")
    model: str | None = Field(default=None, description="Model that generated response")
    usage: dict[str, int] = Field(default_factory=dict, description="Token usage stats")
