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 unclosed aiohttp client session warnings during concurrent requests

Cole McIntosh938e9ace5429
diff --git a/litellm/llms/ollama/completion/transformation.py b/litellm/llms/ollama/completion/transformation.py
index cec27b02d6d..3826a470383 100644
--- a/litellm/llms/ollama/completion/transformation.py
+++ b/litellm/llms/ollama/completion/transformation.py
@@ -465,7 +465,7 @@ class OllamaTextCompletionResponseIterator(BaseModelResponseIterator):
return GenericStreamingChunk(
text="",
is_finished=is_finished,
- finish_reason=None,
+ finish_reason="",
usage=None,
)
else:
diff --git a/tests/test_litellm/llms/ollama/test_ollama_completion_transformation.py b/tests/test_litellm/llms/ollama/test_ollama_completion_transformation.py
index 241558cf3e2..36f282cff83 100644
--- a/tests/test_litellm/llms/ollama/test_ollama_completion_transformation.py
+++ b/tests/test_litellm/llms/ollama/test_ollama_completion_transformation.py
@@ -181,7 +181,7 @@ class TestOllamaTextCompletionResponseIterator:
# Should return empty text and not be finished
assert result["text"] == ""
assert result["is_finished"] is False
- assert result["finish_reason"] is None
+ assert result["finish_reason"] == ""
assert result["usage"] is None
def test_chunk_parser_normal_response(self):