Skip to content

fix: improve json handling and response parsing in textToJSON class#159

Open
KRISHNA-12082006 wants to merge 1 commit intofireform-core:mainfrom
KRISHNA-12082006:fix/json-response-handling
Open

fix: improve json handling and response parsing in textToJSON class#159
KRISHNA-12082006 wants to merge 1 commit intofireform-core:mainfrom
KRISHNA-12082006:fix/json-response-handling

Conversation

@KRISHNA-12082006
Copy link

Summary

This PR improves backend stability and correctness by:

  1. Preventing shared mutable default state in textToJSON.__init__.
  2. Making the answer‑to‑field mapping deterministic by using definitions.
  3. Adding safe handling for Ollama response status and missing data.
  4. Cleaning up plural value parsing logic.

Motivation

  • Prevents hidden bugs where repeated calls leak data.
  • Ensures each field gets the right answer.
  • Avoids crashes when the Ollama server errors.
  • Simplifies plural value parsing for consistent output.

Manual Validation

  • Ran python src/main.py with sample templates.
  • Verified consistent answers in filled PDFs.
  • Ensured error is raised when Ollama is unreachable.

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