mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-18 09:45:23 +00:00
chore(router): add type-discipline suppression reasons for tool-protocol filter
The type-discipline gate counts LIT001/LIT010 against the merge-base ceiling; this change adds the sanctioned suppression markers with reasons instead of new violations: - LIT001 (mutable collection in annotation): the filter's signatures mirror the router's list-or-dict candidate types; functions only read the inputs and build new lists, never mutating them. - LIT010 (assignment without Final): the two new filter call sites rebind the pipeline variable, matching the established progressive narrowing pattern used by every neighboring filter in these methods. No behavior change; comment-only. Signed-off-by: Kylinny <yjydoudou514@gmail.com> Signed-off-by: Kylinny <64238008+Kylinny@users.noreply.github.com>
This commit is contained in:
parent
0092c1ebbd
commit
69e51f40fe
2 changed files with 6 additions and 6 deletions
|
|
@ -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,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue