File size: 1,572 Bytes
868c437
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from pydantic import BaseModel, Field
from typing import List, Literal, Optional

class ChatInput(BaseModel):
    input: str = Field(
        ...,
        description="The user's question or the topic for content generation.",
        examples=["What is the difference between MLOps and LLMOps?"]
    )
    user_type: Literal["student", "instructor"] = Field(
        ...,
        description="The type of user making the request.",
        examples=["student"]
    )
    request_type: Literal["tutoring", "quiz_generation", "flashcard_creation"] = Field( # <-- ADD flashcard_creation
        ...,
        description="The type of request, e.g., a tutoring question or a request to generate content.",
        examples=["quiz_generation"]
    )
    
    subject: Optional[str] = Field(
        None, 
        description="The subject or topic, can be used for filtering or context.",
        examples=["LLMOps Fundamentals"]
    )
    difficulty_level: Optional[Literal["beginner", "intermediate", "advanced"]] = Field(
        None, 
        description="The desired difficulty level for the response or content.",
        examples=["beginner"]
    )

class Source(BaseModel):
    source: str = Field(..., description="The URL of the source document.")
    name: str = Field(..., description="The name of the source (e.g., 'DirectEd Curriculum').")

class ChatOutput(BaseModel):
    answer: str = Field(..., description="The AI-generated answer or content.")
    sources: Optional[List[Source]] = Field(None, description="A list of source documents used for the answer.")