mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
test(router): cover team_model_has_alternatives directly in the mapped router test
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
76b26e41ab
commit
d0a846c8be
1 changed files with 34 additions and 0 deletions
|
|
@ -896,6 +896,40 @@ def test_arouter_test_team_model():
|
|||
assert result is not None
|
||||
|
||||
|
||||
def test_team_model_has_alternatives():
|
||||
def team_deployment(deployment_id: str, team_id: str, public_model_name: str):
|
||||
return {
|
||||
"model_name": f"model_name_{team_id}_{deployment_id}",
|
||||
"litellm_params": {"model": "openai/gpt-4o-mini", "api_key": "sk-test"},
|
||||
"model_info": {
|
||||
"id": deployment_id,
|
||||
"team_id": team_id,
|
||||
"team_public_model_name": public_model_name,
|
||||
},
|
||||
}
|
||||
|
||||
router = litellm.Router(
|
||||
model_list=[
|
||||
team_deployment("team-a-1", "team-a", "shared-model"),
|
||||
team_deployment("team-a-2", "team-a", "shared-model"),
|
||||
team_deployment("team-a-solo", "team-a", "solo-model"),
|
||||
team_deployment("team-b-1", "team-b", "shared-model"),
|
||||
{
|
||||
"model_name": "plain-model",
|
||||
"litellm_params": {"model": "openai/gpt-4o-mini", "api_key": "sk-test"},
|
||||
"model_info": {"id": "plain-1"},
|
||||
},
|
||||
],
|
||||
)
|
||||
|
||||
assert router.team_model_has_alternatives("team-a-1") is True
|
||||
assert router.team_model_has_alternatives("team-a-2") is True
|
||||
assert router.team_model_has_alternatives("team-a-solo") is False
|
||||
assert router.team_model_has_alternatives("team-b-1") is False
|
||||
assert router.team_model_has_alternatives("plain-1") is False
|
||||
assert router.team_model_has_alternatives("missing-deployment") is False
|
||||
|
||||
|
||||
def test_arouter_ignore_invalid_deployments():
|
||||
"""
|
||||
Test that router.ignore_invalid_deployments is set to True
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue