fix(llms): prevent parse_partial_json from dropping incomplete string values#20631
Open
jackjin1997 wants to merge 3 commits intorun-llama:mainfrom
Open
fix(llms): prevent parse_partial_json from dropping incomplete string values#20631jackjin1997 wants to merge 3 commits intorun-llama:mainfrom
jackjin1997 wants to merge 3 commits intorun-llama:mainfrom
Conversation
| if is_inside_string: | ||
| # Check if we are in an object and this is a key | ||
| prefix = new_s[: new_s.rindex('"')].rstrip() | ||
| print(f"DEBUG: prefix='{prefix}'") |
Collaborator
There was a problem hiding this comment.
Nit: remove debug prints
check_import.py
Outdated
Collaborator
There was a problem hiding this comment.
You committed some debug scripts
Collaborator
There was a problem hiding this comment.
Im not sure if you meant to commit these changes
Collaborator
|
Theres already a PR open for this actually, the other fix seems a bit more straightforward |
Collaborator
|
@jackjin1997 Why do you have two PRs open for the same issue? lmao |
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.
Fixes #20541. The current logic misclassified incomplete string values as keys in partial JSON objects, causing content loss during streaming. This update adds context-aware parsing to correctly handle partial values.