fix(azure.py): fix optional param elif statement

This commit is contained in:
Krrish Dholakia 2024-08-20 12:22:39 -07:00
parent 70df5422ba
commit a4f9ba4a88
2 changed files with 5 additions and 4 deletions

View file

@ -220,8 +220,8 @@ class AzureOpenAIConfig:
elif value == "required" and ( elif value == "required" and (
api_version_year == "2024" and api_version_month <= "05" api_version_year == "2024" and api_version_month <= "05"
): ## check if tool_choice value is supported ## ): ## check if tool_choice value is supported ##
if litellm.drop_params == True or ( if litellm.drop_params is True or (
drop_params is not None and drop_params == True drop_params is not None and drop_params is True
): ):
pass pass
else: else:
@ -231,7 +231,7 @@ class AzureOpenAIConfig:
) )
else: else:
optional_params["tool_choice"] = value 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 json_schema: Optional[dict] = None
schema_name: str = "" schema_name: str = ""
if "response_schema" in value: if "response_schema" in value:
@ -268,6 +268,7 @@ class AzureOpenAIConfig:
optional_params["json_mode"] = True optional_params["json_mode"] = True
elif param in supported_openai_params: elif param in supported_openai_params:
optional_params[param] = value optional_params[param] = value
return optional_params return optional_params
def get_mapped_special_auth_params(self) -> dict: def get_mapped_special_auth_params(self) -> dict:

View file

@ -287,7 +287,7 @@ def test_azure_tool_choice(api_version):
else: else:
assert ( assert (
"tool_choice" not in optional_params "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 optional_params["tool_choice"], api_version
) )