AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(json_parser): remove the tab character that can be present in the generated json. It makes the json.loads function throw an Invalid JSON error
Fabrice Hongffb95eb0310f
diff --git a/scripts/json_parser.py b/scripts/json_parser.pyindex 11ff9ed22e..f7d607a1b3 100644--- a/scripts/json_parser.py+++ b/scripts/json_parser.py@@ -24,6 +24,7 @@ def fix_and_parse_json(json_str: str, try_to_fix_with_gpt: bool = True):"""try:+ json_str = json_str.replace('\t', '')return json.loads(json_str)except Exception as e:# Let's do something manually - sometimes GPT responds with something BEFORE the braces: