mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
Merge branch 'escape-double-quotes-in-json-values' of github.com:PhilipAD/Auto-GPT
This commit is contained in:
@@ -12,13 +12,12 @@ def fix_json(json_string: str, schema: str) -> str:
|
|||||||
# Try to fix the JSON using GPT:
|
# Try to fix the JSON using GPT:
|
||||||
function_string = "def fix_json(json_string: str, schema:str=None) -> str:"
|
function_string = "def fix_json(json_string: str, schema:str=None) -> str:"
|
||||||
args = [f"'''{json_string}'''", f"'''{schema}'''"]
|
args = [f"'''{json_string}'''", f"'''{schema}'''"]
|
||||||
description_string = (
|
description_string = "This function takes a JSON string and ensures that it"\
|
||||||
"Fixes the provided JSON string to make it parseable"
|
" is parseable and fully compliant with the provided schema. If an object"\
|
||||||
" and fully compliant with the provided schema.\n If an object or"
|
" or field specified in the schema isn't contained within the correct JSON,"\
|
||||||
" field specified in the schema isn't contained within the correct"
|
" it is omitted. The function also escapes any double quotes within JSON"\
|
||||||
" JSON, it is omitted.\n This function is brilliant at guessing"
|
" string values to ensure that they are valid. If the JSON string contains"\
|
||||||
" when the format is incorrect."
|
" any None or NaN values, they are replaced with null before being parsed."
|
||||||
)
|
|
||||||
|
|
||||||
# If it doesn't already start with a "`", add one:
|
# If it doesn't already start with a "`", add one:
|
||||||
if not json_string.startswith("`"):
|
if not json_string.startswith("`"):
|
||||||
|
|||||||
Reference in New Issue
Block a user