From 29a45de2531f014f44501bf815f86f7cd8d7cff9 Mon Sep 17 00:00:00 2001 From: Fabrice Hong Date: Wed, 5 Apr 2023 19:08:53 +0200 Subject: [PATCH] fix(json-jixer): enclose arguments in a python multi-line string so the fix_json assistant (GPT-3.5) can understand we are providing 2 strings arguments instead of one --- 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 11ff9ed22e..cb05796d44 100644 --- a/scripts/json_parser.py +++ b/scripts/json_parser.py @@ -51,7 +51,7 @@ def fix_and_parse_json(json_str: str, try_to_fix_with_gpt: bool = True): 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] + args = [f"'''{json_str}'''", f"'''{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.""" # If it doesn't already start with a "`", add one: