feat: complete production hardening implementation, specialty canonicalization, google-genai migration, voice reliability, sqlite concurrency, and test suite consolidation
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
"""
|
||||
Response contracts, enums, and data models (Rules 102, 103, 104, 105, 116):
|
||||
- ResponseType Enum
|
||||
- QuestionIntent Enum
|
||||
- ResponseContext Input Contract
|
||||
- ResponseResult Output Contract
|
||||
- FactConfidence Model
|
||||
"""
|
||||
|
||||
from enum import Enum
|
||||
from typing import Optional, List, Dict, Any
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class ResponseType(str, Enum):
|
||||
GREETING = "greeting"
|
||||
ACKNOWLEDGEMENT = "acknowledgement"
|
||||
FOLLOW_UP = "follow_up"
|
||||
CLARIFICATION = "clarification"
|
||||
REFUSAL = "refusal"
|
||||
UNKNOWN = "unknown"
|
||||
SAFETY = "safety"
|
||||
CRISIS = "crisis"
|
||||
COMPLETION = "completion"
|
||||
|
||||
|
||||
class QuestionIntent(str, Enum):
|
||||
SYMPTOM_NAME = "symptom_name"
|
||||
SYMPTOM_DURATION = "symptom_duration"
|
||||
SYMPTOM_SEVERITY = "symptom_severity"
|
||||
SYMPTOM_LOCATION = "symptom_location"
|
||||
SYMPTOM_ONSET = "symptom_onset"
|
||||
SYMPTOM_FREQUENCY = "symptom_frequency"
|
||||
SYMPTOM_TRIGGER = "symptom_trigger"
|
||||
ASSOCIATED_SYMPTOMS = "associated_symptoms"
|
||||
|
||||
MEDICAL_HISTORY = "medical_history"
|
||||
MEDICATIONS = "medications"
|
||||
ALLERGIES = "allergies"
|
||||
FAMILY_HISTORY = "family_history"
|
||||
SURGICAL_HISTORY = "surgical_history"
|
||||
|
||||
|
||||
class ResponseContext(BaseModel):
|
||||
language: str = "en"
|
||||
patient_message: str
|
||||
intent: str = "fact_extraction"
|
||||
primary_symptom: Optional[str] = None
|
||||
missing_information: Optional[str] = None
|
||||
selected_question: Optional[str] = None
|
||||
question_intent: Optional[QuestionIntent] = None
|
||||
safety_status: str = "normal"
|
||||
onboarding_completed: bool = False
|
||||
current_state: Optional[Dict[str, Any]] = None
|
||||
|
||||
|
||||
class ResponseResult(BaseModel):
|
||||
response: str
|
||||
language: str = "en"
|
||||
question_intent: Optional[str] = None
|
||||
response_type: ResponseType = ResponseType.FOLLOW_UP
|
||||
|
||||
|
||||
class FactConfidence(BaseModel):
|
||||
source: str = "patient"
|
||||
method: str = "explicit"
|
||||
confidence: float = 1.0
|
||||
Reference in New Issue
Block a user