mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
update get secret logic
This commit is contained in:
parent
96e6b20fad
commit
c9957fff25
2 changed files with 8 additions and 9 deletions
|
@ -211,9 +211,9 @@ def completion(
|
|||
openai.api_type = "openai"
|
||||
# note: if a user sets a custom base - we should ensure this works
|
||||
api_base = (
|
||||
custom_api_base or litellm.api_base or get_secret("OPENAI_API_BASE")
|
||||
custom_api_base or litellm.api_base or get_secret("OPENAI_API_BASE") or "https://api.openai.com/v1"
|
||||
)
|
||||
openai.api_base = api_base or "https://api.openai.com/v1"
|
||||
openai.api_base = api_base
|
||||
openai.api_version = None
|
||||
if litellm.organization:
|
||||
openai.organization = litellm.organization
|
||||
|
|
|
@ -1444,13 +1444,12 @@ def get_secret(secret_name):
|
|||
if litellm.secret_manager_client != None:
|
||||
# TODO: check which secret manager is being used
|
||||
# currently only supports Infisical
|
||||
try:
|
||||
secret = litellm.secret_manager_client.get_secret(
|
||||
secret_name).secret_value
|
||||
if secret != None:
|
||||
return secret # if secret found in secret manager return it
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Secret '{secret_name}' not found in secret manager")
|
||||
except:
|
||||
secret = None
|
||||
return secret
|
||||
elif litellm.api_key != None: # if users use litellm default key
|
||||
return litellm.api_key
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue