Skip to content

Redesign extraction contract for grouped calls and readiness#618

Open
chetanr25 wants to merge 1 commit into
fireform-core:development-approach-cfrom
chetanr25:extraction_api_contract_update
Open

Redesign extraction contract for grouped calls and readiness#618
chetanr25 wants to merge 1 commit into
fireform-core:development-approach-cfrom
chetanr25:extraction_api_contract_update

Conversation

@chetanr25

Copy link
Copy Markdown
Collaborator

Redesign extraction for grouped calls and readiness

Why

The incident contract is now too large for a single LLM pass to extract reliably, something discussion #609 flagged directly. Extraction also needed a real link to a stored incident and a way to tell the user which forms are ready before they hit a failed generate call.

What changed

  • Extraction is described as small field-group calls run in parallel against Ollama, each validated and retried independently, then stitched into one contract document. No more single big pass.
  • The moment extraction completes, a draft incident row is created holding the contract. That row is the single store of incident data going forward. The extraction record keeps only job metadata and the correction history.
  • Added a defaults block (country, timezone, currency) to the extraction request so dates and money resolve correctly without relying on the model to infer them.
  • Added GET /extract/{extract_id}/readiness, comparing the contract against every registered template and reporting which ones are ready to fill and what is missing for the rest. No LLM involved, cheap to call after every correction.
  • Added FieldGap so a missing field comes with enough context (source, where the value should live) for the review screen to explain it properly.
  • validate now takes a template_id instead of a form_type, matching the move to user-registered templates.
  • Template fields not covered by the contract ("open" fields) are now extracted as extra grouped calls in the same run and stored in custom_fields.

Reference

Discussion: #609.
Related Issue: #617

…arallel field-group extraction into a draft incident row, plus a readiness endpoint, defaults block, and template_id validate. Issue fireform-core#617
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant