From e4687e0f03a0bc7e313de24631270fdabfd3f86a Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Fri, 19 Jan 2024 15:45:31 +0100 Subject: [PATCH] fix(agent): Fix "ChatModelResponse not subscriptable" errors in `summarize_text` and `QueryLanguageModel` ability - `summarize_text` and `QueryLanguageModel.__call__` still tried to access `response["content"]`, which isn't possible since upgrading to the OpenAI v1 client library. --- .../autogpt/core/ability/builtins/query_language_model.py | 2 +- autogpts/autogpt/autogpt/processing/text.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autogpts/autogpt/autogpt/core/ability/builtins/query_language_model.py b/autogpts/autogpt/autogpt/core/ability/builtins/query_language_model.py index 63dd5cfb..7a6ae68e 100644 --- a/autogpts/autogpt/autogpt/core/ability/builtins/query_language_model.py +++ b/autogpts/autogpt/autogpt/core/ability/builtins/query_language_model.py @@ -62,5 +62,5 @@ class QueryLanguageModel(Ability): ability_name=self.name(), ability_args={"query": query}, success=True, - message=model_response.response["content"], + message=model_response.response.content or "", ) diff --git a/autogpts/autogpt/autogpt/processing/text.py b/autogpts/autogpt/autogpt/processing/text.py index c0e71c98..5fed8e6b 100644 --- a/autogpts/autogpt/autogpt/processing/text.py +++ b/autogpts/autogpt/autogpt/processing/text.py @@ -119,7 +119,7 @@ async def summarize_text( temperature=0, max_tokens=500, ) - ).response["content"] + ).response.content logger.debug(f"\n{'-'*16} SUMMARY {'-'*17}\n{summary}\n{'-'*42}\n") return summary.strip(), None