Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve parsing complex json strings returned by LLM #989

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

debanjum
Copy link
Member

@debanjum debanjum commented Nov 27, 2024

  • Improve escaping to load complex json objects
  • Fallback to a more forgiving json5 loader if json.loads cannot parse complex json str

This should reduce failures to pick research tool and run code by agent

Gemini doesn't work well when trying to output json objects. Using it
to output raw json strings with complex, multi-line structures
requires more intense clean-up of raw json string for parsing
JSON5 spec is more flexible, try to load using a fast json5 parser if
the stricter json.loads from the standard library can't load the
raw complex json string into a python dictionary/list
@debanjum debanjum force-pushed the improve-complex-json-string-parsing-for-tool-use branch from 1b91274 to 8c120a5 Compare November 27, 2024 05:34
@debanjum debanjum merged commit f1190cc into master Nov 28, 2024
10 checks passed
@debanjum debanjum added the fix Fix something that isn't working as expected label Nov 28, 2024
@debanjum debanjum deleted the improve-complex-json-string-parsing-for-tool-use branch November 28, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Fix something that isn't working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant