fix(router): type the params mapping spread into LiteLLM_Params

_create_deployment merges its untyped params dict with the zeroed PTU pricing
mapping and spreads the result into LiteLLM_Params. The merge widens every
value to Unknown | float | tuple[()] | Mapping[str, float], and because a
spread is checked against each field in turn, basedpyright raised one error per
field: 183 on that one line.

This branch adds eighteen anthropic federation fields to that model, so it
inherited eighteen more errors on a line it does not touch, which is the whole
of the reportArgumentType budget breach. The same effect landed two more in the
azure passthrough transformation.

Naming the merged value as the heterogeneous config mapping it is fixes the
line rather than the symptom. LiteLLM_Params still validates every field at
runtime, so nothing is loosened that was previously enforced. The file drops
from 402 of these errors to 237, which puts the rule below its base count
instead of over its ceiling.
This commit is contained in:
derhornspieler 2026-08-25 23:39:32 -04:00
parent c2b953e5f6
commit 457a0c3024

View file

@ -8156,13 +8156,10 @@ class Router:
if ptu_error is not None and is_ptu_cost_attribution_enabled():
raise ValueError(ptu_error)
zeroed_pricing: Final = zeroed_ptu_pricing(_model_info, _litellm_params) if config_sourced else None
litellm_params: Final[LiteLLM_Params] = LiteLLM_Params(
**(
_litellm_params
if zeroed_pricing is None
else MappingProxyType({**_litellm_params, **zeroed_pricing})
)
merged_params: Final[Mapping[str, Any]] = (
_litellm_params if zeroed_pricing is None else MappingProxyType({**_litellm_params, **zeroed_pricing})
)
litellm_params: Final[LiteLLM_Params] = LiteLLM_Params(**merged_params)
warn_on_provider_credential_mismatch(model_name=_model_name, litellm_params=_litellm_params)
deployment = Deployment(
**deployment_info,