From e7fb6828a2a3cd8e46ec61d53d3bc7d300881c57 Mon Sep 17 00:00:00 2001 From: Andy Wermke Date: Tue, 24 Dec 2024 20:07:57 +0100 Subject: [PATCH] Fix error handling bug in ChatDeepInfra In the async ClientResponse, `response.text` is not a string property, but an asynchronous function returning a string. --- libs/community/langchain_community/chat_models/deepinfra.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/community/langchain_community/chat_models/deepinfra.py b/libs/community/langchain_community/chat_models/deepinfra.py index a0875aa8fe86b..b23402cdc06f0 100644 --- a/libs/community/langchain_community/chat_models/deepinfra.py +++ b/libs/community/langchain_community/chat_models/deepinfra.py @@ -290,7 +290,7 @@ async def _completion_with_retry(**kwargs: Any) -> Any: async with request.apost( url=self._url(), data=self._body(kwargs), timeout=request_timeout ) as response: - self._handle_status(response.status, response.text) + self._handle_status(response.status, await response.text()) return await response.json() except Exception as e: print("EX", e) # noqa: T201