From fa070c26504bb597a0abf3a53a4949ddd2f03dd6 Mon Sep 17 00:00:00 2001 From: Chengxuan Wang Date: Wed, 17 Jun 2026 09:09:51 -0700 Subject: [PATCH] fix(lint): use builtin generics in build_mid_stream_continuation_messages Swap List[...] -> list[...] in the new helper so the change adds 0 UP006 violations; the litellm_internal_staging strict-rule budget is tighter than litellm_oss_branch and flagged the 4 added annotations. --- litellm/router_utils/fallback_event_handlers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/litellm/router_utils/fallback_event_handlers.py b/litellm/router_utils/fallback_event_handlers.py index affaf629931..b6e59861590 100644 --- a/litellm/router_utils/fallback_event_handlers.py +++ b/litellm/router_utils/fallback_event_handlers.py @@ -40,11 +40,11 @@ def _prefill_explicitly_unsupported(model_group: Optional[str]) -> bool: def build_mid_stream_continuation_messages( - messages: List[Any], + messages: list[Any], generated_content: str, model_group: Optional[str], - fallbacks: Optional[List[Any]] = None, -) -> List[Any]: + fallbacks: Optional[list[Any]] = None, +) -> list[Any]: """Build the message list a mid-stream fallback uses to resume an interrupted stream. By default the partial response is appended as a prefixed assistant message, @@ -63,7 +63,7 @@ def build_mid_stream_continuation_messages( configured fallback target for this model group is explicitly marked as not supporting prefill. """ - candidate_models: List[Optional[str]] = [model_group] + candidate_models: list[Optional[str]] = [model_group] if fallbacks is not None and model_group is not None: try: # Shallow copy: get_fallback_model_group POPS a matching entry from