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: add missing Dict/Optional imports in ChatGPT streaming_utils

Chesars5495003e6058
diff --git a/litellm/llms/chatgpt/chat/streaming_utils.py b/litellm/llms/chatgpt/chat/streaming_utils.py
index 730becb06e6..3232b452a37 100644
--- a/litellm/llms/chatgpt/chat/streaming_utils.py
+++ b/litellm/llms/chatgpt/chat/streaming_utils.py
@@ -4,7 +4,7 @@ Streaming utilities for ChatGPT provider.
Normalizes non-spec-compliant tool_call chunks from the ChatGPT backend API.
"""
-from typing import Any
+from typing import Any, Dict, Optional
class ChatGPTToolCallNormalizer:
diff --git a/tests/test_litellm/litellm_core_utils/test_streaming_handler.py b/tests/test_litellm/litellm_core_utils/test_streaming_handler.py
index 153ca5d5aab..72a7c6fc9a1 100644
--- a/tests/test_litellm/litellm_core_utils/test_streaming_handler.py
+++ b/tests/test_litellm/litellm_core_utils/test_streaming_handler.py
@@ -1274,6 +1274,7 @@ def test_usage_chunk_after_finish_reason_updates_hidden_params(logging_obj):
assert hidden_usage.completion_tokens == 135, (
f"Expected completion_tokens=135 from provider, got {hidden_usage.completion_tokens}"
)
+
@pytest.mark.asyncio
async def test_custom_stream_wrapper_aclose():
"""Test that aclose() delegates to the underlying completion_stream's aclose()"""