51 lines
1.7 KiB
Python
51 lines
1.7 KiB
Python
"""Witness output schemas: agreement map, transparency report, final response."""
|
||
|
||
from typing import Any
|
||
|
||
from pydantic import BaseModel, Field
|
||
|
||
|
||
class AgreementMap(BaseModel):
|
||
"""Map of agreed vs disputed claims from heads."""
|
||
|
||
agreed_claims: list[dict[str, Any]] = Field(
|
||
default_factory=list,
|
||
description="Claims with consensus support",
|
||
)
|
||
disputed_claims: list[dict[str, Any]] = Field(
|
||
default_factory=list,
|
||
description="Conflicting or contested claims",
|
||
)
|
||
confidence_score: float = Field(..., ge=0.0, le=1.0, description="Overall confidence [0, 1]")
|
||
|
||
|
||
class TransparencyReport(BaseModel):
|
||
"""Transparency report produced by Witness."""
|
||
|
||
head_contributions: list[dict[str, Any]] = Field(
|
||
default_factory=list,
|
||
description="Per-head contribution (head_id, summary, key_claims)",
|
||
)
|
||
agreement_map: AgreementMap = Field(..., description="Agreed and disputed claims")
|
||
safety_report: str = Field(default="", description="High-level safety/compliance summary")
|
||
confidence_score: float = Field(..., ge=0.0, le=1.0, description="Overall confidence [0, 1]")
|
||
|
||
|
||
class FinalResponse(BaseModel):
|
||
"""Final user-facing response from Witness arbitration."""
|
||
|
||
final_answer: str = Field(..., min_length=1, description="Composed narrative answer")
|
||
transparency_report: TransparencyReport = Field(..., description="Full transparency payload")
|
||
head_contributions: list[dict[str, Any]] = Field(
|
||
default_factory=list,
|
||
description="Which heads contributed (1–2 lines each)",
|
||
)
|
||
confidence_score: float = Field(..., ge=0.0, le=1.0, description="Overall confidence [0, 1]")
|
||
|
||
|
||
__all__ = [
|
||
"AgreementMap",
|
||
"TransparencyReport",
|
||
"FinalResponse",
|
||
]
|