-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
80 lines (61 loc) · 2.68 KB
/
models.py
File metadata and controls
80 lines (61 loc) · 2.68 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
"""
FastAPI request/response schemas.
"""
from typing import Any
from pydantic import BaseModel, Field
class AnalyzeResponse(BaseModel):
studentId: str = Field(..., description="Student identifier")
confused: bool = Field(..., description="Whether the student seems confused")
confidence: float = Field(..., ge=0.0, le=1.0, description="Degree to which the student appears not to understand")
emotion: str = Field(..., description="Top FER emotion label")
gptReason: str = Field(..., alias="gpt_reason", description="Reason generated by GPT")
signalType: str = Field(..., alias="signal_type", description="Detected understanding decline signal type")
signalSubtype: str = Field(..., alias="signal_subtype", description="Detected understanding decline signal subtype")
signalLabel: str = Field(..., alias="signal_label", description="Display label for the detected signal")
faceFeatures: dict[str, Any] = Field(..., alias="face_features", description="FER and MediaPipe features")
class Config:
populate_by_name = True
class SummarizeRequest(BaseModel):
audioText: str = Field(..., description="Lecture transcript text")
class CoachingSignalItem(BaseModel):
signalType: str
label: str
count: int
class CoachingRecentAlertItem(BaseModel):
classId: str
capturedAt: str
topic: str | None = ""
reason: str | None = ""
confusionPercent: int
class CoachingRequest(BaseModel):
date: str
curriculum: str | None = ""
classId: str | None = ""
classIds: list[str] = Field(default_factory=list)
participantCount: int = 0
alertCount: int = 0
avgConfusionPercent: int = 0
topKeywords: list[str] = Field(default_factory=list)
topTopics: list[str] = Field(default_factory=list)
signalBreakdown: list[CoachingSignalItem] = Field(default_factory=list)
recentAlerts: list[CoachingRecentAlertItem] = Field(default_factory=list)
class SummarizeResponse(BaseModel):
summary: str = Field(..., description="Summary generated by GPT")
recommendedConcept: str = Field(
...,
description="Concept the instructor may want to additionally explain to students",
)
keywords: list[str] = Field(
default_factory=list,
description="Up to five concise keywords extracted from the lecture",
)
class ErrorResponse(BaseModel):
detail: str
class CoachingResponse(BaseModel):
summary: str
priorityLevel: str
coachingTips: list[str] = Field(default_factory=list)
reExplainTopics: list[str] = Field(default_factory=list)
studentSignals: list[str] = Field(default_factory=list)
recommendedActionNow: str
sampleMentions: list[str] = Field(default_factory=list)