Patch: improve ollama 404 api error message, fix #15147 (#15156)

Make this issue more clearly exposed to developers
This commit is contained in:
chyroc 2023-12-27 03:07:39 +08:00 committed by GitHub
parent e52a734818
commit 3a3f880e5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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