SuperAGI
SuperAGI copied to clipboard
Stuck in infinite loop. "Could not parse invalid json"
Yes, I've been having this issue for several kinds of tasks. The problem is using JSON to parse the agent's answers because even GPT4 isn't good at escaping strings for JSON fields.
So, in the meantime, you could add the following text at the end of the agent description:
Remember to escape the double quotes in the command string whenever you request a command, like creating a file. For example,
```"content": "{\n "name": "discord-supabase-bot",\n "version": "1.0.0",\n "description": "A Discord bot that saves messages to Supabase"\n}"```
Is wrong. It should be
```"content": "{\"name\": \"discord-supabase-bot\",\"version\": \"1.0.0\",\"description\": \"A Discord bot that saves messages to Supabase\"}"```
Note how the external quotes are not escaped, only the quotes inside the string. Also, there are no newlines or spaces in the string representation of the JSON object.
It won't fix the issue, but it will reduce its occurrence.
Going through the same issue here.
This is the method (check_and_clean_json from json_cleaner.py) where the json should be parsed and clean.
And the issues happened here (output_parser.py):
This is the method (check_and_clean_json from json_cleaner.py) where the json should be parsed and clean.
And the issues happened here (output_parser.py):
However, the real input is the llm model response.
This is the method (check_and_clean_json from json_cleaner.py) where the json should be parsed and clean. And the issues happened here (output_parser.py):
However, the real input is the llm model response.
Did you fix it?
This seems to be one of the major issues I run into as well. I love this project and hope this issue isn't too difficult to address. It seems to happen the most when I ask it to code something, even a simple python script, (other then "hello world") can generate this error.
This seems to be one of the major issues I run into as well. I love this project and hope this issue isn't too difficult to address. It seems to happen the most when I ask it to code something, even a simple python script, (other then "hello world") can generate this error.
It doesn't look that hard. AGI like auto-gpt also have a kind of method to fix json which works. I currently don't have enough time to really contribute. Maybe later :).
I've also been encountering this issue
It's nearly unusable without this fixed.
We have fixed this issue. Thus closing this.