mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-17 04:34:25 +00:00
fix(proxy): ignore a display_name set on config credential_list entries so non-string values cannot fail boot
This commit is contained in:
parent
e96e337d79
commit
0cedc7ed80
2 changed files with 19 additions and 1 deletions
|
|
@ -6314,7 +6314,8 @@ class ProxyConfig:
|
|||
credential_list = []
|
||||
if credential_list_dict:
|
||||
credential_list = [
|
||||
CredentialItem.model_validate({**cred, "source": "config"}) for cred in credential_list_dict
|
||||
CredentialItem.model_validate({**cred, "display_name": None, "source": "config"})
|
||||
for cred in credential_list_dict
|
||||
]
|
||||
return credential_list
|
||||
|
||||
|
|
|
|||
|
|
@ -1874,6 +1874,23 @@ def test_ProxyConfig_load_credential_list_tags_every_entry_as_config_defined():
|
|||
assert [(cred.credential_name, cred.source) for cred in creds] == [("plain", "config"), ("claims-db", "config")]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("display_name", [2024, True, "Azure Prod"])
|
||||
def test_ProxyConfig_load_credential_list_ignores_a_display_name_set_in_config(display_name):
|
||||
creds = ProxyConfig().load_credential_list(
|
||||
{
|
||||
"credential_list": [
|
||||
{
|
||||
"credential_name": "azure_cred",
|
||||
"display_name": display_name,
|
||||
"credential_info": {},
|
||||
"credential_values": {"api_key": "sk-x"},
|
||||
}
|
||||
]
|
||||
}
|
||||
)
|
||||
assert [(cred.credential_name, cred.display_name) for cred in creds] == [("azure_cred", None)]
|
||||
|
||||
|
||||
def test_ProxyConfig_load_credential_list_invalid_entry_raises():
|
||||
pc = ProxyConfig()
|
||||
with pytest.raises(ValidationError):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue