lov2 / app /schemas /answer_evaluation.py
work-sejal
Deploy LearningOutcomeOS AI Service and dataset to HF Space
3795605
Raw
History Blame Contribute Delete
1.2 kB
"""Pydantic schemas for the answer evaluation endpoint."""
from pydantic import BaseModel, ConfigDict, Field
class AnswerEvaluationRequest(BaseModel):
"""Request model for POST /ai/v2/evaluate-answer."""
model_config = ConfigDict(extra="forbid")
question_id: str = Field(..., min_length=1, max_length=50)
question_text: str = Field(..., min_length=5, max_length=2000)
student_answer: str = Field(..., min_length=1, max_length=5000)
model_answer: str = Field(..., min_length=1, max_length=5000)
rubric: str = Field(..., min_length=1, max_length=2000)
max_marks: int = Field(..., ge=1, le=100)
grade: int = Field(..., ge=6, le=8)
subject: str
lo_id: str = Field(..., min_length=1, max_length=50)
bloom_level: str
class AnswerEvaluationResponse(BaseModel):
"""Response model for POST /ai/v2/evaluate-answer."""
prediction_id: str
model_version: str
source: str
confidence: float = Field(..., ge=0.0, le=1.0)
timestamp: str
predicted_marks: float = Field(..., ge=0.0)
max_marks: int
concepts_covered: list[str]
missing_points: list[str]
feedback: str
teacher_review_required: bool # always True in V2