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.
This commit is contained in:
Reinier van der Leer
2024-01-19 15:45:31 +01:00
parent c5b17851e0
commit e4687e0f03
2 changed files with 2 additions and 2 deletions

View File

@@ -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 "",
)

View File

@@ -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