fix(health): satisfy type-discipline LIT001/LIT002 on probe strip

Annotate the required mutable dict copy/filter so the gate does not count new dict annotations or constructions.
This commit is contained in:
lei_lei 2026-08-31 09:04:27 +00:00
parent 410ba0d62c
commit 110e87cce6

View file

@ -128,9 +128,15 @@ def _is_health_check_model_metadata_key(key: str) -> bool:
return key.startswith("supports_") or key in _HEALTH_CHECK_MODEL_METADATA_KEYS
def _strip_model_metadata_from_health_params(litellm_params: dict) -> dict:
def _strip_model_metadata_from_health_params(
litellm_params: Mapping[str, object],
) -> dict: # mutable-ok: ahealth_check kwargs and LiteLLM_Params(**probe) need a mutable dict
"""Drop model_info capability keys that leaked onto the health-check probe params."""
return {k: v for k, v in litellm_params.items() if not _is_health_check_model_metadata_key(k)}
return { # mutable-ok: ahealth_check kwargs and LiteLLM_Params(**probe) need a mutable dict
k: v
for k, v in litellm_params.items()
if not _is_health_check_model_metadata_key(k)
}
def _get_process_rss_mb() -> float | None:
@ -755,7 +761,7 @@ def _update_litellm_params_for_health_check(model_info: dict, litellm_params: di
the provider request body (#38941)
"""
# Copy first: callers pass the live deployment litellm_params dict.
litellm_params = dict(litellm_params)
litellm_params = dict(litellm_params) # mutable-ok: copy so probe mutations don't rewrite the shared deployment dict # rebind-ok: local probe copy
mode: Final = _resolve_health_check_mode(
model_info,
litellm_params, # any-ok: untyped router config dict