-
Notifications
You must be signed in to change notification settings - Fork 43.4k
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
Amalgam of INVALID JSON issues #1407
Comments
I did some work on this front two months ago: "Code to parse the deepest object on a malformed JSON." It uses ijson for tokenizing, and it follows the interpreter pattern. Hope this helps |
The server is empty or i don't have permissions |
here is a link to the server: then you can click on the link given by pi |
I am currently looking into this |
Disclaimer: Nvmd my previous comment, I was hallucinating 😂 . I think now I might have something useful though: Some thoughts on that issue Input json string
fix_and_parse_json output
line 6 column 92 => "\n-"
which leads to json.decoder.JSONDecodeError in OBS3: Another option I noticed is when receiving an almost-valid json like:
(missing { } around) and OBS4: Kind of a mix between OBS 3 and OBS 2, here the JSON is almost valid (missing enclosing {}) and there is trash in the end
|
I did something that solved the issue for me. Feel free to make any amends or ignore 🤷♂️😝
change line 29 to 51 to this:
It solves the issue for 3 of the scenarios I shared above:
It is definitely not collectively exhaustive, but as I said, I didn't get into the loop after that running for a few hours. |
I think this issue bleeds over to file related commands on windows as well : |
still having this problem...what is the fix? |
I'm not sure if this has been proposed yet, but at least giving it a graceful way to fail and break out of the loop might be helpful. Also, having the ability to save progress so that a user can terminate and resume from where they left off might be a way to "reset" the bug. Also, deep re-parsing of the bad json or treating a missing key with special handling other than a generic error and retry could help. A prompt restating the required format has probably already been tried :( |
Missing 'command' object in JSON
|
Traceback (most recent call last): |
Related to #21 (Invalid Json) |
How to use this? |
This issue has automatically been marked as stale because it has not had any activity in the last 50 days. You can unstale it by commenting or removing the label. Otherwise, this issue will be closed in 10 days. |
I had an idea to solve this wrong JSON format problem. Maybe you could handle it by just sending the wrong formatted JSON string to ChatGPT and specify that it needs to output a correct validated JSON without any additional text. This is how I usually handle such problems.. |
@simwai It may work, yes, but when you have a lot of queries trying to return structured JSON that becomes very costly really fast. |
That's true. Maybe, it would be more optimal to add the required structure in the prompt which asked for the JSON. It could also be enough to forbid ChatGPT in the prompt to write invalid JSON. Most optimal is I guess to do a normal fix approach (without ChatGPT) when a wrong JSON appears, and when the validation of the fixed JSON fails to use the fix by additional ChatGPT query as last rescue. |
This issue has automatically been marked as stale because it has not had any activity in the last 50 days. You can unstale it by commenting or removing the label. Otherwise, this issue will be closed in 10 days. |
Im still having these issues. any fixes for it yet? |
Having this issue as well. |
@Pwuts thanks for the fix!!! |
Duplicates
Summary 💡
Here's a community challenge!
https://github.com/Torantulino/Auto-GPT/labels/invalid_json
We have 19 PRs pertaining to INVALID JSON
Forever grateful if relevant contributors can get together and figure out a solution for this.
I've created a Discord thread:
https://discord.com/channels/1092243196446249134/1095817829405704305/1096547270217977916
EDIT: D'oh that link doesn't quite do the job. In the #dev-autogpt channel, you should see an "Invalid JSON thread" thread.
If we can use the Discord thread for transient convo, and this discussion thread for intel/actionables, we can maybe keep it clean.
Examples 🌈
No response
Motivation 🔦
No response
The text was updated successfully, but these errors were encountered: