From ebc3845dacea41b2248a7c2f02cc48f74b222102 Mon Sep 17 00:00:00 2001 From: Deepanshu Date: Tue, 4 Aug 2026 14:04:25 -0400 Subject: [PATCH] fix(router): annotate _stream_chunks_have_generated_content with Sequence, not list The type_discipline_gate LIT001 check flags mutable-collection parameter annotations. chunks is only iterated, never mutated, so Sequence is the correct read-only annotation and clears the ratcheted budget ceiling. --- litellm/router.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/router.py b/litellm/router.py index 254542ed19f..b49535ba6ef 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -19,7 +19,7 @@ import threading import time import traceback from collections import defaultdict -from collections.abc import AsyncGenerator, Callable, Generator, Mapping +from collections.abc import AsyncGenerator, Callable, Generator, Mapping, Sequence from functools import lru_cache from typing import ( TYPE_CHECKING, @@ -308,7 +308,7 @@ def model_info_is_active_for_environment(model_info: Mapping[str, object] | None _PreRoutingStrategyT = TypeVar("_PreRoutingStrategyT") -def _stream_chunks_have_generated_content(chunks: list[ModelResponseStream]) -> bool: +def _stream_chunks_have_generated_content(chunks: Sequence[ModelResponseStream]) -> bool: for chunk in chunks: if not chunk.choices: continue