-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Labels
bugSomething isn't workingSomething isn't workingtriageIssue needs to be triaged/prioritizedIssue needs to be triaged/prioritized
Description
Bug Description
parse_partial_json contains an internal logic bug when handling incomplete JSON string values.
For inputs where a string value is truncated (e.g. missing the closing quote), the function incorrectly treats the unfinished value as an incomplete key and removes it, even though the key–value structure is already established.
This results in existing value content being dropped and replaced with null, which does not match the intended behavior of completing partial JSON. The issue is caused by incorrect internal logic that determines whether an unfinished string corresponds to an incomplete key or an incomplete value.
I plan to submit a PR to fix this logic.
Version
llama_index_core==0.14.13
Steps to Reproduce
from llama_index.core.llms.utils import parse_partial_json
result = parse_partial_json('{"key": "value')
print(result) # got {'key': None} expected {'key': 'value'}Relevant Logs/Tracbacks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtriageIssue needs to be triaged/prioritizedIssue needs to be triaged/prioritized