Add an LLM fact-check pass over the generated briefing
After summarisation the report is verified against the collected payload (numbers, directions, unsupported claims) by a second LLM call with a Verification JSON schema. Major issues trigger one revision and a re-check; minor-only verdicts are normalized to ok. Failures never block delivery. The verdict is stored in the result JSON and shown on the dashboard (badge + 검증 메모). Disable with US2KR_VERIFY_ENABLED. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+11
-1
@@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from typing import Protocol
|
||||
|
||||
from us2kr.models import MarketPayload, Report
|
||||
from us2kr.models import MarketPayload, Report, Verification, VerificationIssue
|
||||
|
||||
|
||||
class LLMError(RuntimeError):
|
||||
@@ -15,3 +15,13 @@ class LLMProvider(Protocol):
|
||||
def summarize(self, payload: MarketPayload) -> tuple[Report, str]:
|
||||
"""Return (validated Report, model id that produced it). Raise LLMError on total failure."""
|
||||
...
|
||||
|
||||
def verify(self, payload: MarketPayload, report: Report) -> tuple[Verification, str]:
|
||||
"""Fact-check `report` against the payload. Raise LLMError on total failure."""
|
||||
...
|
||||
|
||||
def revise(
|
||||
self, payload: MarketPayload, report: Report, issues: list[VerificationIssue]
|
||||
) -> tuple[Report, str]:
|
||||
"""Return a corrected Report addressing `issues`. Raise LLMError on total failure."""
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user