fix: add missing Dict/Optional imports in ChatGPT streaming_utils

Fixes NameError at runtime when ChatGPTToolCallNormalizer is
instantiated. The imports were missed when type hints were changed
from Python 3.10+ syntax (dict[], str | None) to typing module
syntax (Dict[], Optional[str]).
This commit is contained in:
Chesars 2026-03-02 17:19:40 -03:00
parent 7ab46104e2
commit 5495003e60
2 changed files with 2 additions and 1 deletions

View file

@ -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:

View file

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