diff options
Diffstat (limited to 'autogpts/autogpt/autogpt/core/prompting/utils.py')
-rw-r--r-- | autogpts/autogpt/autogpt/core/prompting/utils.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/autogpts/autogpt/autogpt/core/prompting/utils.py b/autogpts/autogpt/autogpt/core/prompting/utils.py index a6c31cee7..4b1be47f4 100644 --- a/autogpts/autogpt/autogpt/core/prompting/utils.py +++ b/autogpts/autogpt/autogpt/core/prompting/utils.py @@ -14,9 +14,10 @@ def to_numbered_list( def json_loads(json_str: str): - # TODO: this is a hack function for now. Trying to see what errors show up in testing. - # 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). + # TODO: this is a hack function for now. We'll see what errors show up in testing. + # Can hopefully just replace with a call to ast.literal_eval. + # Can't use json.loads because 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("}") + 1] return ast.literal_eval(json_str) |