Merge pull request #1712 from BillSchumacher/master

Merge #72
pull/87/head
Richard Beales 2023-04-15 22:01:32 +01:00 committed by GitHub
commit dfe5550ad0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 7 deletions

View File

@ -21,13 +21,12 @@ def fix_json(json_string: str, schema: str) -> str:
# Try to fix the JSON using GPT:
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"
" field specified in the schema isn't contained within the correct"
" JSON, it is omitted.\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 within JSON"\
" string values to ensure that they are valid. If the JSON string contains"\
" any None or NaN values, they are replaced with null before being parsed."
# If it doesn't already start with a "`", add one:
if not json_string.startswith("`"):