File size: 759 Bytes
bbe01fe
 
 
 
 
 
 
 
 
cbc066c
bbe01fe
 
 
 
84c1ab9
 
 
 
 
 
4ef165a
 
 
 
bbe01fe
 
 
 
 
 
 
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
from typing import List

from pydantic import BaseModel, Field


class SourceRef(BaseModel):
    title: str
    url: str
    section: str
    source_type: str | None = None


class ChatRequest(BaseModel):
    message: str = Field(..., min_length=1, max_length=500)
    session_id: str = Field(
        ...,
        min_length=1,
        max_length=64,
        pattern=r"^[a-zA-Z0-9_-]+$",
    )
    # True when the query was submitted via a follow-up pill button.
    # Bypasses the Gemini fast-path unconditionally so pill follow-ups
    # always produce cited, chunk-grounded answers rather than TOON summaries.
    is_followup: bool = False


class ChatResponse(BaseModel):
    answer: str
    sources: List[SourceRef]
    cached: bool
    latency_ms: int