from typing import List from pydantic import BaseModel, Field class QueryAnalysis(BaseModel): is_clear: bool = Field( description="Indicates if the user's question is clear and answerable." ) questions: List[str] = Field( description="List of rewritten, self-contained questions." ) clarification_needed: str = Field( description="Explanation if the question is unclear." ) starts_new_query: bool = Field( default=False, description="True if the latest message starts a separate request instead of answering the pending clarification." ) is_document_listing: bool = Field( default=False, description="True only when asking which uploaded documents are available, whether any are available, or to list the app's document library. Not for questions about document contents." )