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]

chore: merge main into capability classifier copy

Tin Chi Lo2da9bbfc0f0b
diff --cc litellm/router_strategy/complexity_router/complexity_router.py
index 26769e1d3da,1000f0f479f..72f22e0bab0
--- a/litellm/router_strategy/complexity_router/complexity_router.py
+++ b/litellm/router_strategy/complexity_router/complexity_router.py
@@@ -4159,7 -4088,9 +4286,14 @@@ class ComplexityRouter(CustomLogger)
housekeeping_ceiling: Final = tier if outcome.cause == "housekeeping" else None
# A context-escalated tier becomes the hard floor: a floor the bandit can slide
# under is not a floor.
- routed_model = self._soft_floor_pick(
- adaptive_floor: Final = tier if context_original_tier is not None else plan_floor
++ adaptive_floor: Final = (
++ tier
++ if context_original_tier is not None
++ or outcome.cause in ("capability_classifier", "capability_classifier_fallback")
++ else plan_floor
++ )
+ adaptive_fit: Final = context_placement.holdable_models if context_placement is not None else None
+ sampled_model: Final = self._soft_floor_pick(
tier,
ask,
request_kwargs,
diff --cc tests/test_litellm/router_strategy/test_complexity_router.py
index 09dfc077430,cd72388ea21..8dbd36087b5
--- a/tests/test_litellm/router_strategy/test_complexity_router.py
+++ b/tests/test_litellm/router_strategy/test_complexity_router.py
@@@ -7,10 -7,9 +7,10 @@@ Tests the rule-based complexity scorin
import asyncio
import json
import logging
+import math
import sys
import time
- from collections.abc import AsyncIterator, Mapping
+ from collections.abc import AsyncIterator, Mapping, Sequence
from copy import deepcopy
from functools import partial
from typing import Dict, Final, List, Literal