| """Pydantic models for request/response schemas.""" |
| from pydantic import BaseModel, Field |
| from typing import Optional, List, Dict, Any |
| from datetime import datetime |
| from .enums import ModelName, AgentType |
|
|
|
|
| |
|
|
| class TokenRequest(BaseModel): |
| """Request for JWT token (can be extended with username/password).""" |
| |
| |
| pass |
|
|
|
|
| class TokenResponse(BaseModel): |
| """JWT token response.""" |
| access_token: str |
| token_type: str = "bearer" |
| expires_in: int |
|
|
|
|
| |
|
|
| class CompletionRequest(BaseModel): |
| """Request for text completion.""" |
| message: str = Field(..., description="User message to complete") |
| model: ModelName = Field(default=ModelName.GPT_5_PRO, description="LLM model to use") |
| agent_type: AgentType = Field(default=AgentType.SIMPLE, description="Agent type to use") |
| stream: bool = Field(default=False, description="Enable streaming response") |
| temperature: float = Field(default=0.7, ge=0.0, le=2.0, description="Sampling temperature") |
| max_tokens: Optional[int] = Field(default=None, description="Maximum tokens to generate") |
| conversation_history: Optional[List[Dict[str, str]]] = Field( |
| default=None, |
| description="Optional conversation history" |
| ) |
|
|
|
|
| class CompletionResponse(BaseModel): |
| """Response for text completion (non-streaming).""" |
| response: str |
| model: str |
| agent_type: str |
| usage: Optional[Dict[str, Any]] = None |
| metadata: Optional[Dict[str, Any]] = None |
|
|
|
|
| class StreamChunk(BaseModel): |
| """Single chunk in streaming response.""" |
| content: str |
| done: bool = False |
| metadata: Optional[Dict[str, Any]] = None |
|
|
|
|
| |
|
|
| class TranscriptionResponse(BaseModel): |
| """Response for audio transcription.""" |
| text: str |
| language: Optional[str] = None |
| duration: Optional[float] = None |
| model: str = "whisper-1" |
|
|
|
|
| |
|
|
| class ModelInfo(BaseModel): |
| """Information about an available model.""" |
| name: str |
| provider: str |
| description: Optional[str] = None |
| supports_streaming: bool = True |
| context_window: Optional[int] = None |
|
|
|
|
| class ModelsListResponse(BaseModel): |
| """List of available models.""" |
| models: List[ModelInfo] |
| total: int |
|
|
|
|
| class AgentInfo(BaseModel): |
| """Information about an available agent.""" |
| type: AgentType |
| name: str |
| description: str |
| available: bool = True |
|
|
|
|
| class AgentsListResponse(BaseModel): |
| """List of available agents.""" |
| agents: List[AgentInfo] |
| total: int |
|
|
|
|
| |
|
|
| class ErrorResponse(BaseModel): |
| """Error response.""" |
| error: str |
| detail: Optional[str] = None |
| timestamp: datetime = Field(default_factory=datetime.utcnow) |
|
|
|
|
| |
|
|
| class HealthResponse(BaseModel): |
| """Health check response.""" |
| status: str |
| version: str |
| timestamp: datetime = Field(default_factory=datetime.utcnow) |
|
|
|
|