fix(main.py): read openai org from env

This commit is contained in:
Krrish Dholakia 2023-10-09 16:49:22 -07:00
parent 69e40cdb31
commit 6c7fa8a4aa

View file

@ -376,8 +376,11 @@ def completion(
or get_secret("OPENAI_API_BASE") or get_secret("OPENAI_API_BASE")
or "https://api.openai.com/v1" or "https://api.openai.com/v1"
) )
if litellm.organization: openai.organization = (
openai.organization = litellm.organization litellm.organization
or get_secret("OPENAI_ORGANIZATION")
or None # default - https://github.com/openai/openai-python/blob/284c1799070c723c6a553337134148a7ab088dd8/openai/util.py#L105
)
# set API KEY # set API KEY
api_key = ( api_key = (
api_key or api_key or