Fix case where index throws value error.

pull/759/head
BillSchumacher 2023-04-10 21:55:35 -05:00
parent 95f9380f13
commit 66d316a19c
No known key found for this signature in database
GPG Key ID: 1133789BDD03E12A
1 changed files with 1 additions and 1 deletions

View File

@ -53,7 +53,7 @@ def fix_and_parse_json(
last_brace_index = json_str.rindex("}")
json_str = json_str[:last_brace_index+1]
return json.loads(json_str)
except json.JSONDecodeError as e: # noqa: F841
except (json.JSONDecodeError, ValueError) as e: # noqa: F841
if try_to_fix_with_gpt:
print("Warning: Failed to parse AI output, attempting to fix."
"\n If you see this warning frequently, it's likely that"