Veda-AI-Backend / app /models /generated_paper.py
aayushhh-operator's picture
Upload 33 files
8ce9715 verified
Raw
History Blame Contribute Delete
1.04 kB
from pydantic import BaseModel, Field
from typing import List, Optional
class QuestionSchema(BaseModel):
id: str
text: str
type: str = Field(..., description="mcq, short_answer, long_answer, true_false")
difficulty: str = Field(..., description="easy, medium, hard")
marks: int = Field(..., ge=1)
options: Optional[List[str]] = None
answerKey: str
class SectionSchema(BaseModel):
id: str
title: str
instruction: str
questionType: str = Field(..., description="mcq, short_answer, long_answer, true_false")
questions: List[QuestionSchema] = Field(..., min_length=1)
totalMarks: int = Field(..., ge=1)
class GeneratedPaperDocument(BaseModel):
id: str = Field(..., description="Custom id for the paper")
assignmentId: str
schoolName: str
subject: str
grade: str
duration: int = Field(..., ge=1)
totalMarks: int = Field(..., ge=1)
sections: List[SectionSchema] = Field(..., min_length=1)
createdAt: str
class Config:
populate_by_name = True