fix: handle nested JSON in parse_judge_output via raw_decode#875
Open
sjoerdvink99 wants to merge 1 commit intogenerative-computing:mainfrom
Open
fix: handle nested JSON in parse_judge_output via raw_decode#875sjoerdvink99 wants to merge 1 commit intogenerative-computing:mainfrom
sjoerdvink99 wants to merge 1 commit intogenerative-computing:mainfrom
Conversation
Contributor
|
The PR description has been updated. Please fill out the template for your PR to be reviewed. |
psschwei
reviewed
Apr 16, 2026
Member
psschwei
left a comment
There was a problem hiding this comment.
Thanks for the PR! A few comments below.
| if data is not None: | ||
| score = data.get("score") | ||
| justification = data.get("justification") | ||
| return score, justification if isinstance(justification, str) else judge_output |
Member
There was a problem hiding this comment.
nit
Suggested change
| return score, justification if isinstance(justification, str) else judge_output | |
| return score, (justification if isinstance(justification, str) else judge_output) |
Member
There was a problem hiding this comment.
Another thing to note: if there is no justification, this will now return (score, judge_output) whereas before it would've returned (score, None). Probably should call that out explicitly in the PR description.
Member
There was a problem hiding this comment.
May be worth adding some additional test cases:
- JSON with score but no justification key
- "justification": null (explicit null)
- Multiple JSON objects where the first lacks score
- Direct unit tests for _extract_first_json
2aa1be7 to
9643264
Compare
Member
|
There's a ruff check that's failing @sjoerdvink99 |
Signed-off-by: sjoerdvink99 <sjoerdvink@icloud.com>
9643264 to
79f3a8a
Compare
Author
|
Fixed now @psschwei ! |
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.
Misc PR
Type of PR
Description
Fixes #865
Previously,
parse_judge_outputreturned(score, None)when the judge output contained a JSON object with ascorekey but nojustificationkey (or an explicitnulljustification). It now returns(score, judge_output)falling back to the full raw output string as the justification. This avoids silently discarding context when the judge omits a justification field.Testing
Attribution