mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
fix(proxy_server.py): fix linting errors
This commit is contained in:
parent
284fb64f4d
commit
fbdcde1a54
2 changed files with 13 additions and 21 deletions
|
@ -59,7 +59,7 @@ fallbacks: Optional[List] = None
|
||||||
context_window_fallbacks: Optional[List] = None
|
context_window_fallbacks: Optional[List] = None
|
||||||
allowed_fails: int = 0
|
allowed_fails: int = 0
|
||||||
####### SECRET MANAGERS #####################
|
####### SECRET MANAGERS #####################
|
||||||
secret_manager_client = None # list of instantiated key management clients - e.g. azure kv, infisical, etc.
|
secret_manager_client: Optional[Any] = None # list of instantiated key management clients - e.g. azure kv, infisical, etc.
|
||||||
#############################################
|
#############################################
|
||||||
|
|
||||||
def get_model_cost_map(url: str):
|
def get_model_cost_map(url: str):
|
||||||
|
|
|
@ -295,32 +295,24 @@ def load_from_azure_key_vault(use_azure_key_vault: bool = False):
|
||||||
from azure.identity import ClientSecretCredential
|
from azure.identity import ClientSecretCredential
|
||||||
|
|
||||||
# Set your Azure Key Vault URI
|
# Set your Azure Key Vault URI
|
||||||
KVUri = os.getenv("AZURE_KEY_VAULT_URI")
|
KVUri = os.getenv("AZURE_KEY_VAULT_URI", None)
|
||||||
|
|
||||||
# Set your Azure AD application/client ID, client secret, and tenant ID
|
# Set your Azure AD application/client ID, client secret, and tenant ID
|
||||||
client_id = os.getenv("AZURE_CLIENT_ID")
|
client_id = os.getenv("AZURE_CLIENT_ID", None)
|
||||||
client_secret = os.getenv("AZURE_CLIENT_SECRET")
|
client_secret = os.getenv("AZURE_CLIENT_SECRET", None)
|
||||||
tenant_id = os.getenv("AZURE_TENANT_ID")
|
tenant_id = os.getenv("AZURE_TENANT_ID", None)
|
||||||
|
|
||||||
# Initialize the ClientSecretCredential
|
if KVUri is not None and client_id is not None and client_secret is not None and tenant_id is not None:
|
||||||
credential = ClientSecretCredential(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)
|
# Initialize the ClientSecretCredential
|
||||||
|
credential = ClientSecretCredential(client_id=client_id, client_secret=client_secret, tenant_id=tenant_id)
|
||||||
|
|
||||||
# Create the SecretClient using the credential
|
# Create the SecretClient using the credential
|
||||||
client = SecretClient(vault_url=KVUri, credential=credential)
|
client = SecretClient(vault_url=KVUri, credential=credential)
|
||||||
|
|
||||||
litellm.secret_manager_client = client
|
litellm.secret_manager_client = client
|
||||||
# # Retrieve all secrets
|
else:
|
||||||
# secrets = client.get_secrets()
|
raise Exception(f"Missing KVUri or client_id or client_secret or tenant_id from environment")
|
||||||
|
|
||||||
# # Load secrets into environment variables
|
|
||||||
# for secret in secrets:
|
|
||||||
# secret_name = secret.name
|
|
||||||
# secret_value = client.get_secret(secret_name).value
|
|
||||||
# os.environ[secret_name] = secret_value
|
|
||||||
|
|
||||||
print(f"test key - : {litellm.get_secret('test-3')}")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
|
||||||
print("Error when loading keys from Azure Key Vault. Ensure you run `pip install azure-identity azure-keyvault-secrets`")
|
print("Error when loading keys from Azure Key Vault. Ensure you run `pip install azure-identity azure-keyvault-secrets`")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue