mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
Merge 103e14e23a into e768ad55ce
This commit is contained in:
commit
97157cc895
1 changed files with 26 additions and 0 deletions
26
tests/test_router_fallback_chain.py
Normal file
26
tests/test_router_fallback_chain.py
Normal 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 == []
|
||||
Loading…
Add table
Reference in a new issue