From 60261b48dca90e260024a9d3e9720fd2397c1681 Mon Sep 17 00:00:00 2001 From: rain <1504569896@qq.com> Date: Tue, 15 Sep 2026 01:44:31 +0800 Subject: [PATCH] style: satisfy the type-discipline budget gate on the streamed-items accumulator --- litellm/responses/streaming_iterator.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/litellm/responses/streaming_iterator.py b/litellm/responses/streaming_iterator.py index 48d5af58aad..06fd45f4855 100644 --- a/litellm/responses/streaming_iterator.py +++ b/litellm/responses/streaming_iterator.py @@ -296,7 +296,7 @@ class BaseResponsesAPIStreamingIterator: # output_item.done events seen during the stream, keyed by output_index. # Some providers emit a terminal response.completed event with an empty # output array even though items were streamed; these are used to rebuild it. - self._streamed_output_items: dict[int, object] = {} + self._streamed_output_items: dict[int, object] = {} # mutable-ok: streaming accumulator keyed by output_index self._stream_created_time: float = time.time() # track request context for hooks @@ -522,15 +522,17 @@ class BaseResponsesAPIStreamingIterator: self._handle_failure(e) raise - def get_streamed_output_items(self) -> list[object]: + def get_streamed_output_items(self) -> list[object]: # mutable-ok: response.output takes a real list """ Output items received via response.output_item.done events, ordered by output_index. Used to rebuild a terminal response.completed payload whose output array is empty. """ if not self._streamed_output_items: - return [] - return [item for _, item in sorted(self._streamed_output_items.items())] + return [] # mutable-ok: response.output takes a real list + return [ + item for _, item in sorted(self._streamed_output_items.items()) + ] # mutable-ok: response.output takes a real list def _log_completed_response(self, *, is_async: bool) -> None: if self._completed_response_logged: