feat: two-pass EXTRACT (claims -> typed Facts) for prose chunks
His diagnosis accepted (26/10): the single-pass EXTRACT's giant typed JSON array (verbatim quotes + temporal restrictions + sibling orders) is the output budget behind the 40-minute arithmetic on slow local models. Two-pass shortens EVERY output: - Pass 1 ExtractClaims: plain claim strings, coreferences resolved (entities named, never pronouns) — near-zero format tax. - Pass 2 TypeClaim: ONE claim -> one typed Fact per call (same Fact schema the store eats; temporal fields optional, containment-checked downstream as always). Orders NEVER produced here: one claim at a time has no siblings — the legacy Fact keeps orders for the single-pass path and table frags, untouched. - extract_mode: two_pass (default) | single (legacy) — config-driven, read from config.yaml's knowledge block by run_app. - Budget: Pass 1 charges once per chunk; Pass 2 charges once per claim. Table frags keep the legacy single-pass call. - Prompt log: CLAIMS/TYPE stage labels added. TDD: two_pass_extract 5/5 (signatures, coref law, honest empties) + two_pass_wiring 2/2 (end-to-end on a real store: two_pass ingests typed facts with windows kept; single-pass control green). Suite: 29 test files green. The router from #26 makes the upcoming extraction-model swap a pure config edit.
This commit is contained in:
@@ -130,6 +130,7 @@ def main() -> None:
|
||||
max_chunks_extracted=kcfg.get("max_chunks_extracted", 6),
|
||||
chunk_chars_target=kcfg.get("chunk_chars_target", 32000),
|
||||
chunk_chars_cap=kcfg.get("chunk_chars_cap", 48000),
|
||||
extract_mode=kcfg.get("extract_mode", "two_pass"),
|
||||
)
|
||||
ke = KnowledgeExpert(config=kconfig, streams=streams)
|
||||
knowledge_engine = KnowledgeEngine(ke)
|
||||
|
||||
Reference in New Issue
Block a user