mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
test_router_get_deployment_credentials_with_provider
This commit is contained in:
parent
9817347013
commit
1b88cfbe60
1 changed files with 44 additions and 0 deletions
|
|
@ -458,6 +458,50 @@ def test_router_get_deployment_credentials():
|
|||
assert credentials["api_key"] == "123"
|
||||
|
||||
|
||||
def test_router_get_deployment_credentials_with_provider():
|
||||
"""
|
||||
Test that get_deployment_credentials_with_provider returns credentials with provider info.
|
||||
"""
|
||||
router = Router(
|
||||
model_list=[
|
||||
{
|
||||
"model_name": "gpt-4o",
|
||||
"litellm_params": {
|
||||
"model": "gpt-4o",
|
||||
"api_key": "sk-test-123",
|
||||
"api_base": "https://api.openai.com/v1",
|
||||
},
|
||||
"model_info": {"id": "openai-deployment-1"},
|
||||
},
|
||||
{
|
||||
"model_name": "claude-3",
|
||||
"litellm_params": {
|
||||
"model": "anthropic/claude-3-sonnet",
|
||||
"api_key": "sk-ant-123",
|
||||
},
|
||||
"model_info": {"id": "anthropic-deployment-1"},
|
||||
},
|
||||
]
|
||||
)
|
||||
|
||||
# Test getting credentials by model_id
|
||||
credentials = router.get_deployment_credentials_with_provider(model_id="openai-deployment-1")
|
||||
assert credentials is not None
|
||||
assert credentials["api_key"] == "sk-test-123"
|
||||
assert credentials["custom_llm_provider"] == "openai"
|
||||
assert credentials["api_base"] == "https://api.openai.com/v1"
|
||||
|
||||
# Test getting credentials by model_group_name (model_name)
|
||||
credentials2 = router.get_deployment_credentials_with_provider(model_id="claude-3")
|
||||
assert credentials2 is not None
|
||||
assert credentials2["api_key"] == "sk-ant-123"
|
||||
assert credentials2["custom_llm_provider"] == "anthropic"
|
||||
|
||||
# Test with non-existent model
|
||||
credentials3 = router.get_deployment_credentials_with_provider(model_id="non-existent")
|
||||
assert credentials3 is None
|
||||
|
||||
|
||||
def test_router_get_deployment_model_info():
|
||||
router = Router(
|
||||
model_list=[
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue