| """Shared state passed between LangGraph nodes.""" |
|
|
| from typing import TypedDict, Literal, Optional |
|
|
|
|
| class ClaimCitation(TypedDict): |
| claim: str |
| citation_marker: str |
| reference_string: str |
| resolved_paper_id: Optional[str] |
| evidence_text: Optional[str] |
|
|
|
|
| class Verdict(TypedDict): |
| label: Literal["SUPPORT", "NOT_ENOUGH_INFO", "CONTRADICT"] |
| confidence: float |
| source: Literal["deberta", "llm"] |
|
|
|
|
| class ClaimAudit(TypedDict): |
| claim_citation: ClaimCitation |
| winner_sentence: Optional[str] |
| attribution_available: bool |
| deberta_verdict: Optional[Verdict] |
| llm_verdict: Optional[Verdict] |
| agreement: Optional[bool] |
| escalated: bool |
| escalation_trace: Optional[list] |
| final_verdict: Optional[Verdict] |
| attribution: Optional[list] |
| resolution_note: Optional[str] |
|
|
|
|
| class GraphState(TypedDict): |
| """Top-level state for one full document audit run.""" |
| source_text: str |
| claims: list[ClaimCitation] |
| audits: list[ClaimAudit] |
| current_index: int |
| report: Optional[dict] |
|
|