fix(router): filter model_alias_map as router-only kwargs

This commit is contained in:
languor-daiduode 2026-10-19 17:47:42 +08:00
parent 6762d65eb8
commit d2da41c775
2 changed files with 17 additions and 1 deletions

View file

@ -28,7 +28,9 @@ from litellm.types.utils import LlmProviders, ProviderSpecificModelInfo
_V = TypeVar("_V")
MID_STREAM_CONTINUATION_KWARG: Final = "_mid_stream_continuation"
ROUTER_ONLY_CALL_KWARGS: Final = frozenset({"silent_model", "include_fallback_errors", MID_STREAM_CONTINUATION_KWARG})
ROUTER_ONLY_CALL_KWARGS: Final = frozenset(
{"model_alias_map", "silent_model", "include_fallback_errors", MID_STREAM_CONTINUATION_KWARG}
)
_OBJECT_MAPPING_ADAPTER: Final[TypeAdapter[Mapping[object, object]]] = TypeAdapter(Mapping[object, object])

View file

@ -0,0 +1,14 @@
from litellm.router_utils.common_utils import without_router_only_kwargs
def test_without_router_only_kwargs_removes_model_alias_map():
kwargs = {
"model": "gpt-4o",
"model_alias_map": {"alias": "gpt-4o"},
"silent_model": "shadow-model",
"include_fallback_errors": True,
"_mid_stream_continuation": True,
}
assert without_router_only_kwargs(kwargs) == {"model": "gpt-4o"}
assert kwargs["model_alias_map"] == {"alias": "gpt-4o"}