from typing import List, Optional, Literal from pydantic import BaseModel, Field from sanatan_assistant import allowedScriptureTitles class Question(BaseModel): preferred_language: str = Field( description="User's preferred language. Respond in this language" ) question: str = Field(description="The generated question to be asked to the user. Do not capture the expected answer here. Just the question only.") scripture: allowedScriptureTitles = Field( description="The scripture title this question is sourced from (e.g., Bhagavad Gita, Divya Prabandham)" ) native_lyrics: str = Field( description="The lyrics in its native/original script (e.g., Sanskrit/Tamil). Sanitize this if there are garbled characters. This could be multi-line. capture entirely." ) transliteration: str = Field( description="The transliterated text of the verse in English/the user's preferred language" ) translation: str = Field( description="The translated meaning of the verse in English/the user's preferred language" ) detailed_explanation: Optional[str] = Field( default=None, description="A detailed explanation of the verse or context, if available in the context", ) word_by_word_meaning: Optional[str] = Field( default=None, description="Word-by-word meaning (in both native and english) or breakdown of the verse, if available in the context", ) verse_number: Optional[int] = Field( default=None, description="The absolute verse number from the context if available.", ) page_number: Optional[int] = Field( default=None, description="The page number from the context if available." ) verse_reference: Optional[str] = Field( default=None, description="The reference identifier of the verse or the title (e.g., TVM 1.4.5). Include the prabandham_name as well if available. Do not capture the scripture name here.", ) reference_link: Optional[str] = Field( default=None, description="The html_url if available" ) complexity: Literal["beginner", "intermediate", "advanced"] = Field( description="Difficulty level of the question" ) choices: List[str] = Field( description="List of multiple-choice options. Leave empty for open-text questions" ) expected_answer: str = Field( description="The correct or expected answer to the question" ) answer_explanation: str = Field( description="Explanation why the expected answer is correct" ) expected_choice_index: Optional[int] = Field( default=None, description="Index of the correct choice in 'choices'. Null if open-text question", ) class AnswerValidation(BaseModel): is_correct: bool = Field(description="Whether the provided answer is correct") reasoning: str = Field(description="Explanation of why the answer is correct or not") correct_answer: str = Field(description="The correct/expected answer from the question object")