The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(azure.py): fix optional param elif statement
Krrish Dholakiaa4f9ba4a8808
diff --git a/litellm/llms/azure.py b/litellm/llms/azure.pyindex 409536dc131..00cdb90cfd2 100644--- a/litellm/llms/azure.py+++ b/litellm/llms/azure.py@@ -220,8 +220,8 @@ class AzureOpenAIConfig:elif value == "required" and (api_version_year == "2024" and api_version_month <= "05"): ## check if tool_choice value is supported ##- if litellm.drop_params == True or (- drop_params is not None and drop_params == True+ if litellm.drop_params is True or (+ drop_params is not None and drop_params is True):passelse:@@ -231,7 +231,7 @@ class AzureOpenAIConfig:)else:optional_params["tool_choice"] = value- if param == "response_format" and isinstance(value, dict):+ elif param == "response_format" and isinstance(value, dict):json_schema: Optional[dict] = Noneschema_name: str = ""if "response_schema" in value:@@ -268,6 +268,7 @@ class AzureOpenAIConfig:optional_params["json_mode"] = Trueelif param in supported_openai_params:optional_params[param] = value+return optional_paramsdef get_mapped_special_auth_params(self) -> dict:diff --git a/litellm/tests/test_optional_params.py b/litellm/tests/test_optional_params.pyindex b1ee80b59e3..2b6e07f63c9 100644--- a/litellm/tests/test_optional_params.py+++ b/litellm/tests/test_optional_params.py@@ -287,7 +287,7 @@ def test_azure_tool_choice(api_version):else:assert ("tool_choice" not in optional_params- ), "tool_choice={} for api version={}".format(+ ), "tool choice should not be present. Got - tool_choice={} for api version={}".format(optional_params["tool_choice"], api_version)