feat: added support for OPENAI_API_BASE

This commit is contained in:
Erik Bjäreholt 2023-08-28 14:52:53 +02:00
parent 2096f9c3bf
commit ae52856a62
No known key found for this signature in database
GPG key ID: 73349C58108227B5
3 changed files with 7 additions and 5 deletions

View file

@ -210,12 +210,11 @@ def completion(
): # allow user to make an openai call with a custom base
openai.api_type = "openai"
# note: if a user sets a custom base - we should ensure this works
# allow for the setting of dynamic and stateful api-bases
api_base = (
custom_api_base if custom_api_base is not None else litellm.api_base
) # allow for the setting of dynamic and stateful api-bases
openai.api_base = (
api_base if api_base is not None else "https://api.openai.com/v1"
custom_api_base or litellm.api_base or get_secret("OPENAI_API_BASE")
)
openai.api_base = api_base or "https://api.openai.com/v1"
openai.api_version = None
if litellm.organization:
openai.organization = litellm.organization