This commit is contained in:
Kartik Chilkoti 2026-10-03 08:12:29 -04:00 • committed by GitHub
commit 97157cc895
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,26 @@
import pytest
from litellm import Router
def test_router_fallbacks_initialization():
fallbacks = [
{"gpt-4": ["azure/gpt-4-east", "bedrock/claude-3-5-sonnet"]}
]
router = Router(
model_list=[
{"model_name": "gpt-4", "litellm_params": {"model": "azure/gpt-4-east"}},
{"model_name": "azure/gpt-4-east", "litellm_params": {"model": "azure/gpt-4-east"}},
{"model_name": "bedrock/claude-3-5-sonnet", "litellm_params": {"model": "bedrock/claude-3-5-sonnet"}},
],
fallbacks=fallbacks,
)
assert router.fallbacks == fallbacks
assert len(router.fallbacks) == 1
assert "gpt-4" in router.fallbacks[0]
def test_router_empty_fallbacks():
router = Router(
model_list=[
{"model_name": "gpt-3.5-turbo", "litellm_params": {"model": "gpt-3.5-turbo"}}
]
)
assert router.fallbacks is None or router.fallbacks == []