From 1e073736963d1789774ee2f532dfd3eeeec03fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CPhilip?= Date: Mon, 3 Apr 2023 14:58:27 +0100 Subject: [PATCH] Fix JSON string escaping issue Fixes an issue where double quotes were not being escaped in JSON strings, causing parse errors. --- scripts/json_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/json_parser.py b/scripts/json_parser.py index 11ff9ed2..c36b2c14 100644 --- a/scripts/json_parser.py +++ b/scripts/json_parser.py @@ -52,7 +52,7 @@ def fix_json(json_str: str, schema: str, debug=False) -> str: # Try to fix the JSON using gpt: function_string = "def fix_json(json_str: str, schema:str=None) -> str:" args = [json_str, schema] - description_string = """Fixes the provided JSON string to make it parseable and fully complient with the provided schema.\n If an object or field specifed in the schema isn't contained within the correct JSON, it is ommited.\n This function is brilliant at guessing when the format is incorrect.""" + description_string = """This function takes a JSON string and ensures that it is parseable and fully compliant with the provided schema. If an object or field specified in the schema isn't contained within the correct JSON, it is omitted. The function also escapes any double quotes in the JSON string to ensure that it is valid.""" # If it doesn't already start with a "`", add one: if not json_str.startswith("`"):