From cf4b1afa5237187fbcc93876821a8ceb65b90306 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Tue, 30 Jan 2024 10:56:36 -0800 Subject: [PATCH] (feat) set organization on litellm.completion --- litellm/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/main.py b/litellm/main.py index 05b352fa6..0d6b0caec 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -450,6 +450,7 @@ def completion( num_retries = kwargs.get("num_retries", None) ## deprecated max_retries = kwargs.get("max_retries", None) context_window_fallback_dict = kwargs.get("context_window_fallback_dict", None) + organization = kwargs.get("organization", None) ### CUSTOM MODEL COST ### input_cost_per_token = kwargs.get("input_cost_per_token", None) output_cost_per_token = kwargs.get("output_cost_per_token", None) @@ -787,7 +788,8 @@ def completion( or "https://api.openai.com/v1" ) openai.organization = ( - litellm.organization + organization + or litellm.organization or get_secret("OPENAI_ORGANIZATION") or None # default - https://github.com/openai/openai-python/blob/284c1799070c723c6a553337134148a7ab088dd8/openai/util.py#L105 ) @@ -827,6 +829,7 @@ def completion( timeout=timeout, custom_prompt_dict=custom_prompt_dict, client=client, # pass AsyncOpenAI, OpenAI client + organization=organization, ) except Exception as e: ## LOGGING - log the original exception returned