Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

refactor(router): drop explanatory docstrings from routing group helpers

ryan4bca66f30377
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
index b52d007d9db..0a49aef5c7e 100644
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -6902,12 +6902,6 @@ class ProxyConfig:
@staticmethod
def _apply_router_settings(llm_router: Router, router_settings: Mapping[str, object]) -> None:
- """
- `routing_groups` is applied on its own so a value persisted before
- save-time validation existed cannot abort the reconcile that also loads
- SSO, guardrails and the other DB-backed settings. The router keeps the
- groups it already holds when the new value is rejected.
- """
llm_router.update_settings(**{k: v for k, v in router_settings.items() if k != "routing_groups"})
if "routing_groups" not in router_settings:
return
diff --git a/litellm/router.py b/litellm/router.py
index e31689ef447..23f058ef68e 100644
--- a/litellm/router.py
+++ b/litellm/router.py
@@ -1392,10 +1392,6 @@ class Router:
at most one explicit group. Constructs per-group strategy selectors so
groups with different `routing_strategy_args` track independent state.
- Validation and selector construction run to completion before any
- router state changes, so a rejected input raises with the previously
- loaded groups still routing.
-
Models not claimed by any explicit group are served by the implicit
`"default"` group, whose selectors are the `self.<strategy>_logger`
attributes set up in `routing_strategy_init`.
diff --git a/litellm/router_utils/routing_groups.py b/litellm/router_utils/routing_groups.py
index c9b3b205bf1..ba65ddf8643 100644
--- a/litellm/router_utils/routing_groups.py
+++ b/litellm/router_utils/routing_groups.py
@@ -1,9 +1,3 @@
-"""
-Validation for `router_settings.routing_groups`, shared by the Router and the
-proxy's config-update endpoint so a config the UI saves cannot be one the
-runtime refuses to load.
-"""
-
from collections.abc import Sequence
from typing import Final
@@ -12,11 +6,6 @@ from litellm.types.router import RoutingGroup, RoutingStrategy
def validate_routing_strategy(routing_strategy: RoutingStrategy | str | None) -> None:
- """
- Raises `ValueError` unless `routing_strategy` is a known strategy or None.
-
- See: https://github.com/BerriAI/litellm/issues/11330
- """
if routing_strategy is None:
return
@@ -36,12 +25,6 @@ def parse_routing_groups(
groups_input: Sequence[RoutingGroup | dict] | None,
known_model_names: frozenset[str] = frozenset(),
) -> tuple[RoutingGroup, ...]:
- """
- Parses and validates `routing_groups`, raising `ValueError` on the first
- problem found. Every check runs before the caller mutates any state, so an
- invalid update can never leave a router holding a half-applied set of
- groups.
- """
if not groups_input:
return ()