knowledge: answer-level count corroboration (DESIGN §12) — LIST rows verified via prose
- VerifyCountSignature: LLM finds ONE verbatim sentence in the article prose (tables excluded by construction) stating the set's count - _verify_count: code checks containment + digit equality — no LLM compares numbers; NOQUOTE -> count_corroborated=false (honest, one call, never loops) - row verified <=> complete_per_source AND count_corroborated - DESIGN §12 documents now vs deferred (extension, criteria, cross-article) - live: EU question cold — E1 (50) + E2 (27) both corroborated with quotes, 23 computed; 25/25 tests
This commit is contained in:
+11
-1
@@ -142,6 +142,15 @@ class KnowledgeEngine:
|
||||
prov = {"expert": "knowledge", "source": src,
|
||||
"note": ("source-verified: verbatim containment in trusted doc"
|
||||
if ans.get("quote") else "no quote — unverified")}
|
||||
# LIST rows: the answer-level check corroborates the count outside the
|
||||
# source table; combined with per-source completeness it makes the
|
||||
# row verified (E3-style verified semantics, first non-stub use).
|
||||
verified = False
|
||||
cov = ans.get("coverage") or {}
|
||||
if (isinstance(ans.get("list_items"), list) and ans["list_items"]
|
||||
and cov.get("complete_per_source") and cov.get("count_corroborated")):
|
||||
verified = True
|
||||
prov["note"] = "count corroborated outside the source table"
|
||||
if parent_question:
|
||||
prov["parent_question"] = parent_question
|
||||
note = "" if value.upper() != "UNKNOWN" else "knowledge returned UNKNOWN"
|
||||
@@ -155,6 +164,7 @@ class KnowledgeEngine:
|
||||
engine="knowledge",
|
||||
trace=[f"kg pipeline: source={src} conf={ans.get('confidence', '?')}"],
|
||||
provenance=prov,
|
||||
verified=False, # the prover is still a stub; the quote is source-verified
|
||||
verified=verified, # True only when the count is corroborated
|
||||
# outside the source table (LIST rows)
|
||||
note=note,
|
||||
)
|
||||
Reference in New Issue
Block a user