mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 19:54:13 +00:00
fix(main.py): only set api key to dynamic api key if it's not none
This commit is contained in:
parent
e4deb09eb6
commit
27f5703ca2
1 changed files with 3 additions and 1 deletions
|
@ -371,7 +371,7 @@ def completion(
|
||||||
if deployment_id != None: # azure llms
|
if deployment_id != None: # azure llms
|
||||||
model=deployment_id
|
model=deployment_id
|
||||||
custom_llm_provider="azure"
|
custom_llm_provider="azure"
|
||||||
model, custom_llm_provider, api_key, api_base = get_llm_provider(model=model, custom_llm_provider=custom_llm_provider, api_base=api_base, api_key=api_key)
|
model, custom_llm_provider, dynamic_api_key, api_base = get_llm_provider(model=model, custom_llm_provider=custom_llm_provider, api_base=api_base, api_key=api_key)
|
||||||
custom_prompt_dict = {} # type: ignore
|
custom_prompt_dict = {} # type: ignore
|
||||||
if initial_prompt_value or roles or final_prompt_value or bos_token or eos_token:
|
if initial_prompt_value or roles or final_prompt_value or bos_token or eos_token:
|
||||||
custom_prompt_dict = {model: {}}
|
custom_prompt_dict = {model: {}}
|
||||||
|
@ -391,6 +391,8 @@ def completion(
|
||||||
custom_llm_provider = "openai"
|
custom_llm_provider = "openai"
|
||||||
api_key = model_api_key
|
api_key = model_api_key
|
||||||
|
|
||||||
|
if dynamic_api_key is not None:
|
||||||
|
api_key = dynamic_api_key
|
||||||
# check if user passed in any of the OpenAI optional params
|
# check if user passed in any of the OpenAI optional params
|
||||||
optional_params = get_optional_params(
|
optional_params = get_optional_params(
|
||||||
functions=functions,
|
functions=functions,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue