Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix(ollama.py): correctly raise ollama streaming error

Krrish Dholakia311521e56ef8
diff --git a/litellm/llms/ollama.py b/litellm/llms/ollama.py
index 7b15582f489..6b984e1d826 100644
--- a/litellm/llms/ollama.py
+++ b/litellm/llms/ollama.py
@@ -258,7 +258,7 @@ def get_ollama_response(
logging_obj=logging_obj,
)
return response
- elif stream == True:
+ elif stream is True:
return ollama_completion_stream(url=url, data=data, logging_obj=logging_obj)
response = requests.post(
@@ -326,7 +326,7 @@ def ollama_completion_stream(url, data, logging_obj):
try:
if response.status_code != 200:
raise OllamaError(
- status_code=response.status_code, message=response.text
+ status_code=response.status_code, message=response.read()
)
streamwrapper = litellm.CustomStreamWrapper(