From 4fd3df9b87bd27f8f9a645b6a2ede07fb37f15e4 Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Tue, 17 Oct 2023 19:56:09 -0700 Subject: [PATCH] Unbreak `core.prompting.utils:json_loads` :') --- autogpts/autogpt/autogpt/core/prompting/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogpts/autogpt/autogpt/core/prompting/utils.py b/autogpts/autogpt/autogpt/core/prompting/utils.py index 5a127da9..c7d94076 100644 --- a/autogpts/autogpt/autogpt/core/prompting/utils.py +++ b/autogpts/autogpt/autogpt/core/prompting/utils.py @@ -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: