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.
Merge pull request #1610 from adityaoke/adityaoke/fix_json_str
Richard Beales51fc59b45f3f
diff --cc autogpt/json_fixes/auto_fix.pyindex 9c632332c5,a6f66a4f96..ac648460d5--- a/autogpt/json_fixes/auto_fix.py+++ b/autogpt/json_fixes/auto_fix.py@@@ -1,16 -1,15 +1,17 @@@"""This module contains the function to fix JSON strings using GPT-3."""import json+from autogpt.llm_utils import call_ai_functionfrom autogpt.logs import logger+from autogpt.config import Config+cfg = Config()- def fix_json(json_str: str, schema: str) -> str:+ def fix_json(json_string: str, schema: str) -> str:"""Fix the given JSON string to make it parseable and fully compliant with the provided schema."""# Try to fix the JSON using GPT:- function_string = "def fix_json(json_str: str, schema:str=None) -> str:"- args = [f"'''{json_str}'''", f"'''{schema}'''"]+ function_string = "def fix_json(json_string: str, schema:str=None) -> str:"+ args = [f"'''{json_string}'''", f"'''{schema}'''"]description_string = ("Fixes the provided JSON string to make it parseable"" and fully compliant with the provided schema.\n If an object or"