allow setting litellm.api_key

This commit is contained in:
ishaan-jaff 2023-08-14 17:17:18 -07:00
parent fe32ddeaba
commit f5b6c04de4
3 changed files with 4 additions and 3 deletions

View file

@ -5,6 +5,7 @@ set_verbose=False
telemetry=True telemetry=True
max_tokens = 256 # OpenAI Defaults max_tokens = 256 # OpenAI Defaults
retry = True retry = True
api_key = None
openai_key = None openai_key = None
azure_key = None azure_key = None
anthropic_key = None anthropic_key = None

View file

@ -717,10 +717,10 @@ def get_secret(secret_name):
# if secret manager fails default to using .env variables # if secret manager fails default to using .env variables
os.environ[secret_name] = secret # set to env to be safe os.environ[secret_name] = secret # set to env to be safe
return secret return secret
elif litellm.api_key != None: # if users use litellm default key
return litellm.api_key
else: else:
return os.environ.get(secret_name) return os.environ.get(secret_name)
else:
return os.environ.get(secret_name)
######## Streaming Class ############################ ######## Streaming Class ############################
# wraps the completion stream to return the correct format for the model # wraps the completion stream to return the correct format for the model

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "litellm" name = "litellm"
version = "0.1.389" version = "0.1.390"
description = "Library to easily interface with LLM API providers" description = "Library to easily interface with LLM API providers"
authors = ["BerriAI"] authors = ["BerriAI"]
license = "MIT License" license = "MIT License"