Unbreak `core.prompting.utils:json_loads` :')

pull/5797/head
Reinier van der Leer 2023-10-17 19:56:09 -07:00
parent e0a9341fc0
commit 4fd3df9b87
No known key found for this signature in database
GPG Key ID: CDC1180FDAE06193
1 changed files with 1 additions and 1 deletions

View File

@ -18,7 +18,7 @@ def json_loads(json_str: str):
# Can hopefully just replace with a call to ast.literal_eval (the function api still
# sometimes returns json strings with minor issues like trailing commas).
try:
json_str = json_str[json_str.index("{"):json_str.rindex("}")]
json_str = json_str[json_str.index("{"):json_str.rindex("}")+1]
return ast.literal_eval(json_str)
except json.decoder.JSONDecodeError as e:
try: