mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
chore(router): sync final tier routing edits
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
5bfdd07bf4
commit
e7682eeab4
2 changed files with 7 additions and 10 deletions
|
|
@ -1156,18 +1156,12 @@ class ComplexityRouter(CustomLogger):
|
|||
def _pick_from_tier_value(
|
||||
model: str | list[str] | TierTarget, tier_key: str
|
||||
) -> str: # mutable-ok: legacy pool inputs remain lists
|
||||
if isinstance(model, TierTarget):
|
||||
target_model: Final = model.model
|
||||
if isinstance(target_model, str):
|
||||
return target_model
|
||||
if not target_model:
|
||||
raise ValueError(f"Empty model pool for tier {tier_key}")
|
||||
return random.choice(target_model)
|
||||
if isinstance(model, str):
|
||||
return model
|
||||
if not model:
|
||||
pool: Final = tier_pool(model)
|
||||
if not pool:
|
||||
raise ValueError(f"Empty model pool for tier {tier_key}")
|
||||
return random.choice(model)
|
||||
return random.choice(pool)
|
||||
|
||||
def _tier_pools(self) -> dict[str, list[str]]: # mutable-ok: adaptive router consumes mutable pools
|
||||
return { # mutable-ok: router consumers require mutable tier pool mappings
|
||||
|
|
|
|||
|
|
@ -913,7 +913,10 @@ class TestSingletonMutation:
|
|||
|
||||
def test_default_config_not_mutated(self, mock_router_instance):
|
||||
"""Test that creating routers without config doesn't mutate defaults."""
|
||||
from litellm.router_strategy.complexity_router.config import ComplexityRouterConfig
|
||||
from litellm.router_strategy.complexity_router.config import (
|
||||
DEFAULT_CLASSIFIER_CONTEXT_WINDOW_SIZE,
|
||||
ComplexityRouterConfig,
|
||||
)
|
||||
|
||||
# Get original default
|
||||
original_default = ComplexityRouterConfig().default_model
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue