Spaces:
Running
Running
File size: 1,399 Bytes
516fa71 | 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 | from pydantic import BaseModel
from typing import Optional, List, Literal
ReportSection = Literal[
"FINDINGS",
"IMAGE_CHARACTERISTICS",
"CLINICAL_INTERPRETATION",
"MANAGEMENT_CONSIDERATIONS",
"LIMITATIONS",
"REFERENCES",
]
RootCause = Literal[
"CHUNK_ERROR",
"RETRIEVAL_MISS",
"LLM_HALLUCINATION",
"UNKNOWN",
]
class ChunkRef(BaseModel):
chroma_id: str
content: str
source: str
page: int
similarity_score: float
class CorrectionRequest(BaseModel):
session_id: str
original_report: str
retrieved_context: List[ChunkRef]
features: dict
section: ReportSection
correction_text: str
corrected_snippet: Optional[str] = None
class CorrectionResponse(BaseModel):
correction_id: str
root_cause: RootCause
action_taken: str
affected_chunk_ids: List[str]
verification_query: Optional[str] = None
class CorrectionRecord(BaseModel):
correction_id: str
session_id: str
timestamp: str
section: str
correction_text: str
corrected_snippet: Optional[str]
root_cause: str
action_taken: str
affected_chunk_ids: str # JSON-encoded list
original_report: str
features_json: str
retrieved_context_json: str
verified: bool = False
verification_result: Optional[str] = None
class VerifyRequest(BaseModel):
correction_id: str
features: dict
|