From 3a3f880e5a8c03a2cd0cbadbca4d5d43e3710252 Mon Sep 17 00:00:00 2001 From: chyroc Date: Wed, 27 Dec 2023 03:07:39 +0800 Subject: [PATCH] Patch: improve ollama 404 api error message, fix #15147 (#15156) Make this issue more clearly exposed to developers --- libs/community/langchain_community/llms/ollama.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/community/langchain_community/llms/ollama.py b/libs/community/langchain_community/llms/ollama.py index 64ddf82c801..85e9d72d3ea 100644 --- a/libs/community/langchain_community/llms/ollama.py +++ b/libs/community/langchain_community/llms/ollama.py @@ -196,7 +196,9 @@ class _OllamaCommon(BaseLanguageModel): if response.status_code != 200: if response.status_code == 404: raise OllamaEndpointNotFoundError( - "Ollama call failed with status code 404." + "Ollama call failed with status code 404. " + "Maybe your model is not found " + f"and you should pull the model with `ollama pull {self.model}`." ) else: optional_detail = response.json().get("error")