drdeveloper88's picture
Upload WorldDisasterLM-8B source code: FastAPI backend, training pipeline, 11-language support
495526b
Raw
History Blame Contribute Delete
1.02 kB
from typing import Literal
from pydantic import BaseModel, Field
class ChatMessage(BaseModel):
role: Literal["system", "user", "assistant"]
content: str
class ChatRequest(BaseModel):
messages: list[ChatMessage] = Field(default_factory=list)
language: str = "English"
region: str = "global"
class ChatResponse(BaseModel):
answer: str
confidence: float
needs_human_review: bool
citations: list[str] = Field(default_factory=list)
class RiskAssessmentRequest(BaseModel):
region: str
hazard_type: str
vulnerability_index: float = Field(ge=0.0, le=1.0)
exposure_index: float = Field(ge=0.0, le=1.0)
class RiskAssessmentResponse(BaseModel):
risk_score: float
risk_level: Literal["low", "moderate", "high", "critical"]
recommendation: str
class IncidentClassificationRequest(BaseModel):
text: str
class IncidentClassificationResponse(BaseModel):
incident_type: str
severity: Literal["low", "medium", "high", "critical"]
rationale: str