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