raised JSONDecodeError
Bug description
Executing python code:python startup.py "写个类似今日头条的推荐系统"
Error reported as follows:raised JSONDecodeError
So, the error caused by incorrect json format. At the same time, I find the json format is different elsewhere, as follows:
Now, there are two questions, one is how to fix the bug, the other is why json format annotations are different? Is it random?
Bug solved method
The first question can fix by setting "REPAIR_LLM_OUTPUT: true" in key.yaml. The program runs normally after modification.
The Second question, why json format annotations are different? Is it random? I don't know the answer. Please tell me if you know anything.
Environment information
- LLM type and model name: gpt-4-1106-preview
- System version: macOS Sonoma Version 14.2.1
- Python version: Python 3.11
json is from LLM, so it is random. We have to handle it to make it more standardized.
Add the second way to fix bug about raised JSONDecodeError:
Add prompt "Delete comments in json" of FORMAT_CONSTRAINT in action_node.py, as follows:
raised JSONDecodeError as follows:
add "Delete comments in json", solve the problem: