Introduce schema-driven structured extraction pathway with safe fallback mechanism#355
Open
Arijit429 wants to merge 7 commits into
Open
Introduce schema-driven structured extraction pathway with safe fallback mechanism#355Arijit429 wants to merge 7 commits into
Arijit429 wants to merge 7 commits into
Conversation
Arijit429
commented
Mar 27, 2026
Author
Arijit429
left a comment
There was a problem hiding this comment.
I have checked and run all my changes to check errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #59
Closes #40
Closes #148
Overview
This pull request introduces an optional schema-driven structured extraction pathway to improve the consistency, performance, and future scalability of the LLM-based form filling pipeline in FireForm.
Currently, field extraction is performed iteratively, where the language model is prompted independently for each template field. While this approach works functionally, it may lead to inconsistent outputs, increased latency due to repeated model invocations, and limited visibility into extraction completeness.
This change introduces a structured extraction flow that allows the system to request all relevant fields in a single model interaction, while preserving the existing extraction mechanism as a safe fallback. This ensures backward compatibility and allows incremental adoption of the improved pipeline.
Key Changes
Motivation
In real-world emergency documentation workflows, extraction reliability and response time are critical. Repeated field-level prompting increases the probability of inconsistent responses and adds unnecessary latency.
By enabling schema-driven extraction, this change aims to:
Impact
This enhancement is fully backward compatible and does not modify existing API contracts or database schemas. If structured extraction encounters runtime errors or invalid model outputs, the system seamlessly reverts to the current extraction approach.
The implementation therefore enables experimentation with improved extraction strategies without disrupting existing functionality.
Future Work
This change lays groundwork for several potential improvements, including:
Testing
The updated extraction flow was tested locally by:
No breaking changes were observed in existing workflows.