His direction: stop explaining string formats to the LLM and parsing
them back with Python — dspy does structured output natively and better.
The change (extractor only, PR-10 scope):
Fact(BaseModel) with subject/relation/object/quote OutputFields
ExtractSignature.facts: list[Fact] — the adapter renders the JSON schema into the prompt itself (verified in a live run's prompt log) and parses responses back into typed Fact objects
expert.py consumes typed objects; parse_facts/parse_stop_table kept as LEGACY (tests only)
Verified:
dspy 3.4.1 pattern E2E'd first with a raw-text engine: list[Fact] parses back as Fact objects, schema rendered in prompt
full suite 12/12 green (74 tests) — tablefrags.py updated to script typed Fact objects
live E2E run (ollama-cloud glm-5.3-flash, Italy rivers): correct Po/Adige/Tiber answer; prompt log shows the native JSON schema; 22 table rows ingested cleanly
His direction: stop explaining string formats to the LLM and parsing
them back with Python — dspy does structured output natively and better.
**The change (extractor only, PR-10 scope):**
- `Fact(BaseModel)` with subject/relation/object/quote OutputFields
- `ExtractSignature.facts: list[Fact]` — the adapter renders the JSON schema into the prompt itself (verified in a live run's prompt log) and parses responses back into typed Fact objects
- `STOP_TABLE` string protocol → `stop: bool` OutputField
- expert.py consumes typed objects; parse_facts/parse_stop_table kept as LEGACY (tests only)
**Verified:**
- dspy 3.4.1 pattern E2E'd first with a raw-text engine: `list[Fact]` parses back as Fact objects, schema rendered in prompt
- full suite 12/12 green (74 tests) — tablefrags.py updated to script typed Fact objects
- live E2E run (ollama-cloud glm-5.3-flash, Italy rivers): correct Po/Adige/Tiber answer; prompt log shows the native JSON schema; 22 table rows ingested cleanly
His direction: stop explaining string formats to the LLM and parsing
them back with Python — that's exactly what dspy does natively and
better. The pipe format ('subject | relation | object | quote') was
fragile (run-L verbose values, pipe-in-quote ambiguity, STOP_TABLE
string protocol).
THE CHANGE (extractor only, PR-10 scope):
- Fact(BaseModel) with subject/relation/object/quote OutputFields
- ExtractSignature.facts: list[Fact] — the adapter renders the JSON
schema into the prompt itself (verified in a live run's prompt log)
and parses responses back into typed Fact objects
- STOP_TABLE string protocol -> stop: bool OutputField
- expert.py consumes typed objects; the cand dict is built at the
check_candidate boundary only (checks.py unchanged)
- parse_facts/parse_stop_table kept as LEGACY for existing tests only
VERIFIED:
- dspy 3.4.1 pattern E2E'd first with a raw-text engine: list[Fact]
parses back as Fact objects, schema rendered in prompt (tmp probes)
- full suite 12/12 green (74 tests) — tablefrags.py updated to script
typed Fact objects
- live E2E run (ollama-cloud glm-5.3-flash, Italy rivers): correct
Po/Adige/Tiber answer; prompt log shows the native JSON schema;
table rows ingested cleanly (22 rows, quotes verbatim)
NEXT (his direction, not this PR): apply the same typed-output law to
ALL floop signatures — INIT subquestions, ROUTE engine choice,
AnswerFromKG, SelectTable, SkimPromote, Translate, VerifyCount.
onibot
merged commit 2a515795e5 into main2026-10-22 14:22:05 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
His direction: stop explaining string formats to the LLM and parsing
them back with Python — dspy does structured output natively and better.
The change (extractor only, PR-10 scope):
Fact(BaseModel)with subject/relation/object/quote OutputFieldsExtractSignature.facts: list[Fact]— the adapter renders the JSON schema into the prompt itself (verified in a live run's prompt log) and parses responses back into typed Fact objectsSTOP_TABLEstring protocol →stop: boolOutputFieldVerified:
list[Fact]parses back as Fact objects, schema rendered in promptHis direction: stop explaining string formats to the LLM and parsing them back with Python — that's exactly what dspy does natively and better. The pipe format ('subject | relation | object | quote') was fragile (run-L verbose values, pipe-in-quote ambiguity, STOP_TABLE string protocol). THE CHANGE (extractor only, PR-10 scope): - Fact(BaseModel) with subject/relation/object/quote OutputFields - ExtractSignature.facts: list[Fact] — the adapter renders the JSON schema into the prompt itself (verified in a live run's prompt log) and parses responses back into typed Fact objects - STOP_TABLE string protocol -> stop: bool OutputField - expert.py consumes typed objects; the cand dict is built at the check_candidate boundary only (checks.py unchanged) - parse_facts/parse_stop_table kept as LEGACY for existing tests only VERIFIED: - dspy 3.4.1 pattern E2E'd first with a raw-text engine: list[Fact] parses back as Fact objects, schema rendered in prompt (tmp probes) - full suite 12/12 green (74 tests) — tablefrags.py updated to script typed Fact objects - live E2E run (ollama-cloud glm-5.3-flash, Italy rivers): correct Po/Adige/Tiber answer; prompt log shows the native JSON schema; table rows ingested cleanly (22 rows, quotes verbatim) NEXT (his direction, not this PR): apply the same typed-output law to ALL floop signatures — INIT subquestions, ROUTE engine choice, AnswerFromKG, SelectTable, SkimPromote, Translate, VerifyCount.