feat(credential_accessor.py): fix upserting new credentials via accessor

This commit is contained in:
Krrish Dholakia 2025-03-12 19:03:37 -07:00
parent de1f94154b
commit d024a5d703
4 changed files with 45 additions and 24 deletions

View file

@ -21,8 +21,10 @@ class CredentialAccessor:
def upsert_credentials(credentials: List[CredentialItem]):
"""Add a credential to the list of credentials."""
credential_names = [cred.credential_name for cred in litellm.credential_list]
for credential in credentials:
if credential.credential_name in litellm.credential_list:
if credential.credential_name in credential_names:
# Find and replace the existing credential in the list
for i, existing_cred in enumerate(litellm.credential_list):
if existing_cred.credential_name == credential.credential_name: