Spaces:
Runtime error
Runtime error
File size: 1,044 Bytes
8ce9715 | 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 | 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
|