From a4f9ba4a8808d5e2d756e0cc9afa4aa3315aca7b Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 20 Aug 2024 12:22:39 -0700 Subject: [PATCH] fix(azure.py): fix optional param elif statement --- litellm/llms/azure.py | 7 ++++--- litellm/tests/test_optional_params.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/litellm/llms/azure.py b/litellm/llms/azure.py index 409536dc1..00cdb90cf 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 ): pass else: @@ -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] = None schema_name: str = "" if "response_schema" in value: @@ -268,6 +268,7 @@ class AzureOpenAIConfig: optional_params["json_mode"] = True elif param in supported_openai_params: optional_params[param] = value + return optional_params def get_mapped_special_auth_params(self) -> dict: diff --git a/litellm/tests/test_optional_params.py b/litellm/tests/test_optional_params.py index b1ee80b59..2b6e07f63 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 )