feat(llm): add robust regex fallback parser for JSON responses (fixes #318) - #498
Merged
eshaanag merged 1 commit intoSep 1, 2026
Merged
Conversation
|
@Diwakar-odds is attempting to deploy a commit to the Eshaan's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
|
Hi @eshaanag 👋, I have submitted the PR to fix issue #318. PR Analysis & ECSoC26 Level JustificationThis PR introduces a robust regex-based fallback parser (\parse_llm_json) into the LLM analysis logic, which handles noisy or malformed JSON responses returned by LLM endpoints (e.g., Markdown wrapping or conversational filler).
Given that this PR involves hardening a core backend component (LLM parsing resilience) against format instability, it qualifies as an L2/L3 (Core Backend Resilience) contribution. Could you please review, and assign the \ECSoC26\ label (if missing) along with \good-backend\ or \Level 3? Thank you! |
eshaanag
added a commit
that referenced
this pull request
Sep 1, 2026
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.
Program
What does this PR do?
Introduces a robust fallback utility (
parse_llm_json) inbackend/features/llm_analysis/parser.pythat gracefully handles malformed JSON responses from LLM models. The utility uses regex to strip markdown code blocks and conversational filler, ensuring valid JSON extraction even if the LLM output is wrapped or syntactically noisy.Related issue
Closes #318
Checklist
ECSoC26orELUSOC) to this PR