litellm/tests/test_litellm/router_strategy/adaptive_router
devin-ai-integration[bot] 637fc1f60e
fix(router): tag-aware pre-routing strategy selection for shared model_name (#33691)
* fix(router): tag-aware pre-routing strategy selection for shared model_name

Complexity/auto/adaptive/quality router registries were keyed by model_name
alone, so a second deployment sharing a model_name but carrying different tags
was rejected and every request used the first config. This made tag-based
routing to distinct provider configs behind one alias impossible, surfacing as
401 'Not allowed to access model due to tags configuration' for the second tag.

Each registry now holds a list of tag-scoped strategies and async_pre_routing_hook
selects the entry whose tags match the request before classification, falling
back to a default-tagged then first-registered entry. A repeat of the same
(model_name, tags) pair is still rejected.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(router): cover tag-scoped pre-routing strategy registry helpers

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* chore: re-trigger CI

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Krrish Dholakia <krrishdholakia@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-07-17 09:26:07 -07:00
..
fixtures feat: add adaptive routing to litellm 2026-04-18 16:35:17 -07:00
__init__.py feat: add adaptive routing to litellm 2026-04-18 16:35:17 -07:00
test_adaptive_router.py feat(router): soft-floor adaptive mode for complexity router (#32947) 2026-07-11 21:56:33 -07:00
test_async_pre_routing.py fix(adaptive_router): 3 P1 review defects 2026-04-20 15:22:18 -07:00
test_bandit.py feat: add adaptive routing to litellm 2026-04-18 16:35:17 -07:00
test_classifier.py feat: add adaptive routing to litellm 2026-04-18 16:35:17 -07:00
test_config.py feat: add adaptive routing to litellm 2026-04-18 16:35:17 -07:00
test_e2e_adaptive_router.py feat(router): soft-floor adaptive mode for complexity router (#32947) 2026-07-11 21:56:33 -07:00
test_hooks.py feat(router): soft-floor adaptive mode for complexity router (#32947) 2026-07-11 21:56:33 -07:00
test_router_dispatch.py fix(router): tag-aware pre-routing strategy selection for shared model_name (#33691) 2026-07-17 09:26:07 -07:00
test_signals.py fix(adaptive_router): enforce satisfaction gate, stop false-flagging empty tool output 2026-04-20 17:47:25 -07:00
test_state_endpoint.py fix(router): tag-aware pre-routing strategy selection for shared model_name (#33691) 2026-07-17 09:26:07 -07:00
test_update_queue.py refactor(adaptive_router): move update_queue out of litellm.proxy 2026-04-21 18:02:44 -07:00