Verifier-Service / schemas.py
ArabicNewsAnalyzer's picture
Upload 17 files
51d2734 verified
Raw
History Blame Contribute Delete
2.47 kB
from pydantic import BaseModel
class VerifyRequest(BaseModel):
text: str
class Citation(BaseModel):
title: str = ""
url: str = ""
class JurorVerdictDetail(BaseModel):
juror_id: str
verdict: str
confidence: float = 0.0
reasoning: str = ""
citations: list[Citation] = []
class DebateLogEntry(BaseModel):
juror_id: str
original_verdict: str
original_confidence: float = 0.0
revised_verdict: str
revised_confidence: float = 0.0
changed: bool = False
class ClaimDetail(BaseModel):
"""Per-claim breakdown returned inside the claims[] array."""
claim: str # clean claim text (no [Ψ³ΩŠΨ§Ω‚:] tag)
# SUPPORTED | REFUTED | PARTIALLY_TRUE | UNVERIFIABLE
verdict: str
confidence: float = 0.0 # 0.0 – 1.0
explanation: str = "" # Arabic paragraph from Explainer
# sources used for this specific claim
citations: list[Citation] = []
# ── Jury metadata ────────────────────────────────────────────────────────
needs_human_review: bool = False # True when verdict == UNVERIFIABLE
# post-debate per-juror results
jury_outputs: list[JurorVerdictDetail] = []
debate_log: list[DebateLogEntry] = [] # empty when debate was skipped
class VerifyResponse(BaseModel):
"""
Top-level response from POST /verify.
Article-level fields summarise the full text.
claims[] gives the per-claim breakdown for frontend rendering.
"""
# ── Article-level summary ─────────────────────────────────────────────────
verdict: str # overall article verdict
confidence: float = 0.0 # average confidence across all claims
arabic_explanation: str # combined Arabic summary paragraph
# deduplicated citations across all claims
citations: list[Citation] = []
needs_human_review: bool = False # True if any claim is UNVERIFIABLE
# ── Per-claim breakdown ───────────────────────────────────────────────────
claims: list[ClaimDetail] = []