Tahasaif3's picture
'code'
e103642
"""Pydantic schemas for chat operations."""
from datetime import datetime
from typing import Optional, List, Dict, Any
from uuid import UUID
from pydantic import BaseModel, Field
class ChatRequest(BaseModel):
"""Request schema for chat endpoint."""
message: str = Field(..., min_length=1, max_length=10000, description="User message")
conversation_id: Optional[int] = Field(None, description="Existing conversation ID to continue")
class ToolCallResult(BaseModel):
"""Result of a tool call during agent execution."""
tool: str = Field(..., description="Name of the tool called")
result: Dict[str, Any] = Field(..., description="Result returned by the tool")
class ChatResponse(BaseModel):
"""Response schema for chat endpoint."""
conversation_id: int = Field(..., description="Conversation ID (new or existing)")
response: str = Field(..., description="Assistant's response message")
tool_calls: List[ToolCallResult] = Field(default_factory=list, description="Tool calls made during response")
error: Optional[str] = Field(None, description="Error message if any")
model_config = {"from_attributes": True}