File size: 1,439 Bytes
676582c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""Pydantic schema for chat response."""
from pydantic import BaseModel, Field
from typing import Optional
from datetime import datetime


class ChatResponse(BaseModel):
    """Response schema for chat endpoint.

    Represents the AI assistant's response to a user's message.
    """

    conversation_id: int = Field(
        ...,
        description="ID of the conversation (new or existing)"
    )

    message: str = Field(
        ...,
        description="AI assistant's response message"
    )

    role: str = Field(
        default="assistant",
        description="Role of the message sender (always 'assistant' for responses)"
    )

    timestamp: datetime = Field(
        ...,
        description="Timestamp when the response was generated"
    )

    token_count: Optional[int] = Field(
        default=None,
        description="Number of tokens used in the response"
    )

    model: Optional[str] = Field(
        default=None,
        description="AI model used to generate the response"
    )

    class Config:
        json_schema_extra = {
            "example": {
                "conversation_id": 123,
                "message": "I'd be happy to help you organize your tasks! Let me know what you need to accomplish today.",
                "role": "assistant",
                "timestamp": "2026-01-14T10:30:00Z",
                "token_count": 25,
                "model": "gemini-pro"
            }
        }