From 6c1c3474e868d9486732ed95dddf2ef289912b6e Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Thu, 29 Feb 2024 13:03:02 +0300 Subject: [PATCH 1/2] Update ollama.py --- libs/community/langchain_community/llms/ollama.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/community/langchain_community/llms/ollama.py b/libs/community/langchain_community/llms/ollama.py index 963d28576fec5d..f4d90e3374b7af 100644 --- a/libs/community/langchain_community/llms/ollama.py +++ b/libs/community/langchain_community/llms/ollama.py @@ -236,7 +236,7 @@ def _create_stream( f"and you should pull the model with `ollama pull {self.model}`." ) else: - optional_detail = response.json().get("error") + optional_detail = response.text raise ValueError( f"Ollama call failed with status code {response.status_code}." f" Details: {optional_detail}" @@ -297,7 +297,7 @@ async def _acreate_stream( "Ollama call failed with status code 404." ) else: - optional_detail = await response.json().get("error") # type: ignore[attr-defined] + optional_detail = await response.text # type: ignore[attr-defined] raise ValueError( f"Ollama call failed with status code {response.status}." f" Details: {optional_detail}" From 28d6bf59d58e7bb4801f5588d9370922d0b46de6 Mon Sep 17 00:00:00 2001 From: Bagatur Date: Fri, 1 Mar 2024 11:43:33 -0800 Subject: [PATCH 2/2] fmt --- libs/community/langchain_community/llms/ollama.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/community/langchain_community/llms/ollama.py b/libs/community/langchain_community/llms/ollama.py index f4d90e3374b7af..2dc198fec138bf 100644 --- a/libs/community/langchain_community/llms/ollama.py +++ b/libs/community/langchain_community/llms/ollama.py @@ -297,7 +297,7 @@ async def _acreate_stream( "Ollama call failed with status code 404." ) else: - optional_detail = await response.text # type: ignore[attr-defined] + optional_detail = response.text raise ValueError( f"Ollama call failed with status code {response.status}." f" Details: {optional_detail}"