mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
fix(azure.py): support dropping 'tool_choice=required' for older azure API versions
Closes https://github.com/BerriAI/litellm/issues/3876
This commit is contained in:
parent
054456c50e
commit
7efac4d36c
3 changed files with 157 additions and 41 deletions
|
@ -6045,6 +6045,22 @@ def get_optional_params(
|
|||
optional_params=optional_params,
|
||||
model=model,
|
||||
)
|
||||
elif custom_llm_provider == "azure":
|
||||
supported_params = get_supported_openai_params(
|
||||
model=model, custom_llm_provider="azure"
|
||||
)
|
||||
_check_valid_arg(supported_params=supported_params)
|
||||
api_version = (
|
||||
passed_params.get("api_version", None)
|
||||
or litellm.api_version
|
||||
or get_secret("AZURE_API_VERSION")
|
||||
)
|
||||
optional_params = litellm.AzureOpenAIConfig().map_openai_params(
|
||||
non_default_params=non_default_params,
|
||||
optional_params=optional_params,
|
||||
model=model,
|
||||
api_version=api_version, # type: ignore
|
||||
)
|
||||
else: # assume passing in params for azure openai
|
||||
supported_params = get_supported_openai_params(
|
||||
model=model, custom_llm_provider="azure"
|
||||
|
@ -6481,29 +6497,7 @@ def get_supported_openai_params(
|
|||
elif custom_llm_provider == "openai":
|
||||
return litellm.OpenAIConfig().get_supported_openai_params(model=model)
|
||||
elif custom_llm_provider == "azure":
|
||||
return [
|
||||
"functions",
|
||||
"function_call",
|
||||
"temperature",
|
||||
"top_p",
|
||||
"n",
|
||||
"stream",
|
||||
"stream_options",
|
||||
"stop",
|
||||
"max_tokens",
|
||||
"presence_penalty",
|
||||
"frequency_penalty",
|
||||
"logit_bias",
|
||||
"user",
|
||||
"response_format",
|
||||
"seed",
|
||||
"tools",
|
||||
"tool_choice",
|
||||
"max_retries",
|
||||
"logprobs",
|
||||
"top_logprobs",
|
||||
"extra_headers",
|
||||
]
|
||||
return litellm.AzureOpenAIConfig().get_supported_openai_params()
|
||||
elif custom_llm_provider == "openrouter":
|
||||
return [
|
||||
"functions",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue