mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-17 23:09:35 +00:00
66 lines
1.9 KiB
Python
66 lines
1.9 KiB
Python
"""Contradiction Engine API — detect and manage system contradictions.
|
|
|
|
See repo root: `docs/trust/ledger-vs-tool-verification.md` for how this relates to
|
|
`VerificationLedger` / `tool_verification`.
|
|
"""
|
|
|
|
from fastapi import APIRouter, Depends, HTTPException
|
|
from pydantic import BaseModel as PydanticBase
|
|
from typing import Any, Dict, List, Optional
|
|
|
|
router = APIRouter(prefix="/contradictions", tags=["Contradictions"])
|
|
|
|
|
|
class ContradictionCreate(PydanticBase):
|
|
source_a: str
|
|
source_b: str
|
|
claim_a: str
|
|
claim_b: str
|
|
contradiction_type: str = "factual"
|
|
severity: str = "medium"
|
|
detected_by: str = "manual"
|
|
evidence: Optional[Dict[str, Any]] = None
|
|
|
|
|
|
class ContradictionResolve(PydanticBase):
|
|
resolution: str
|
|
status: str = "resolved"
|
|
|
|
|
|
@router.post("/")
|
|
async def register_contradiction(body: ContradictionCreate) -> Dict[str, Any]:
|
|
"""Register a new contradiction."""
|
|
return {
|
|
"status": "registered",
|
|
"source_a": body.source_a,
|
|
"source_b": body.source_b,
|
|
"contradiction_type": body.contradiction_type,
|
|
"severity": body.severity,
|
|
}
|
|
|
|
|
|
@router.get("/")
|
|
async def list_contradictions() -> Dict[str, Any]:
|
|
"""List active contradictions."""
|
|
return {"contradictions": [], "total": 0}
|
|
|
|
|
|
@router.get("/stats")
|
|
async def contradiction_stats() -> Dict[str, Any]:
|
|
"""Get contradiction statistics."""
|
|
return {"total": 0, "active": 0, "resolved": 0, "critical_active": 0}
|
|
|
|
|
|
@router.get("/{contradiction_id}")
|
|
async def get_contradiction(contradiction_id: str) -> Dict[str, Any]:
|
|
"""Get a specific contradiction."""
|
|
return {"id": contradiction_id, "status": "not_found"}
|
|
|
|
|
|
@router.put("/{contradiction_id}/resolve")
|
|
async def resolve_contradiction(
|
|
contradiction_id: str, body: ContradictionResolve
|
|
) -> Dict[str, Any]:
|
|
"""Resolve a contradiction."""
|
|
return {"id": contradiction_id, "status": body.status, "resolution": body.resolution}
|