From ffb95eb0310f67964562853943a512e069432ab1 Mon Sep 17 00:00:00 2001 From: Fabrice Hong Date: Wed, 5 Apr 2023 20:16:28 +0200 Subject: [PATCH] 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 --- scripts/json_parser.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/json_parser.py b/scripts/json_parser.py index 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: