File size: 936 Bytes
e46d575
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
40
41
42
43
44
45
46
47
from pydantic import BaseModel, Field


class TestGenerateRequest(BaseModel):
    topic: str = Field(..., min_length=2, max_length=200)
    grade: int = Field(..., ge=6, le=12)
    session_id: str


class TestQuestion(BaseModel):
    question: str
    correct_answer: str
    solution_steps: list[str]
    type: str  # "numerical" | "short_answer"


class TestGenerateResponse(BaseModel):
    questions: list[TestQuestion]
    session_id: str


class StudentAnswer(BaseModel):
    question_index: int
    question: str
    correct_answer: str
    student_answer: str


class TestEvaluateRequest(BaseModel):
    session_id: str
    answers: list[StudentAnswer]
    attempt_number: int = 1


class QuestionResult(BaseModel):
    question_index: int
    is_correct: bool
    feedback: str


class TestEvaluateResponse(BaseModel):
    results: list[QuestionResult]
    score: int
    passed: bool
    encouragement: str
    session_id: str