diff --git a/litellm/router.py b/litellm/router.py index 082b4a6179a..1e644433ef2 100644 --- a/litellm/router.py +++ b/litellm/router.py @@ -15039,7 +15039,7 @@ class Router: model, ) ) - healthy_deployments = filter_tool_protocol_deployments( + healthy_deployments = filter_tool_protocol_deployments( # rebind-ok: progressive narrowing of the candidate list through the router filter pipeline; rebinding is the established pattern in this function healthy_deployments=healthy_deployments, request_kwargs=request_kwargs, ) @@ -16355,7 +16355,7 @@ class Router: self._filter_blocked_deployments(healthy_deployments), routing_kwargs ) - healthy_deployments = filter_tool_protocol_deployments( + healthy_deployments = filter_tool_protocol_deployments( # rebind-ok: progressive narrowing of the candidate list through the router filter pipeline; rebinding is the established pattern in this function healthy_deployments=healthy_deployments, request_kwargs=request_kwargs, ) diff --git a/litellm/router_utils/common_utils.py b/litellm/router_utils/common_utils.py index 53b385fc302..03113c13f06 100644 --- a/litellm/router_utils/common_utils.py +++ b/litellm/router_utils/common_utils.py @@ -407,7 +407,7 @@ _OPENAI_NATIVE_PROTOCOL_PROVIDERS: Final = frozenset( ) -def _deployment_speaks_openai_protocol(deployment: dict) -> bool: +def _deployment_speaks_openai_protocol(deployment: dict) -> bool: # mutable-ok: read-only access; router passes plain deployment dicts and this helper never mutates them litellm_params: Final = deployment.get("litellm_params") or {} provider: Final = provider_for_generic_call(litellm_params) if provider is None: @@ -416,9 +416,9 @@ def _deployment_speaks_openai_protocol(deployment: dict) -> bool: def filter_tool_protocol_deployments( - healthy_deployments: list[dict] | dict, - request_kwargs: dict | None = None, -) -> list[dict] | dict: + healthy_deployments: list[dict] | dict, # mutable-ok: mirrors the router list-or-dict candidate type; the filter builds new lists and never mutates inputs + request_kwargs: dict | None = None, # mutable-ok: matches the OptionalParams dict type used across the router; read-only in this function +) -> list[dict] | dict: # mutable-ok: returns the input or a narrowed new list; same list-or-dict contract as the router pipeline """ Keep only OpenAI-protocol deployments for OpenAI-format tool-calling requests.