diff --git a/litellm/llms/azure.py b/litellm/llms/azure.py index 3536ec9a6e..a92a03803d 100644 --- a/litellm/llms/azure.py +++ b/litellm/llms/azure.py @@ -147,7 +147,6 @@ class AzureOpenAIConfig: api_version_year = api_version_times[0] api_version_month = api_version_times[1] api_version_day = api_version_times[2] - args = locals() for param, value in non_default_params.items(): if param == "tool_choice": """ diff --git a/litellm/main.py b/litellm/main.py index 7021137a81..d71b046a01 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -838,6 +838,7 @@ def completion( logprobs=logprobs, top_logprobs=top_logprobs, extra_headers=extra_headers, + api_version=api_version, **non_default_params, ) diff --git a/litellm/tests/test_streaming.py b/litellm/tests/test_streaming.py index 6c1cb61286..25f36826d2 100644 --- a/litellm/tests/test_streaming.py +++ b/litellm/tests/test_streaming.py @@ -2828,6 +2828,7 @@ async def test_azure_astreaming_and_function_calling(): password=os.environ["REDIS_PASSWORD"], ) try: + litellm.set_verbose = True response = await litellm.acompletion( model="azure/gpt-4-nov-release", tools=tools, diff --git a/litellm/utils.py b/litellm/utils.py index 5f42c2f46e..7769027080 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -5192,6 +5192,7 @@ def get_optional_params( logprobs=None, top_logprobs=None, extra_headers=None, + api_version=None, **kwargs, ): # retrieve all parameters passed to the function @@ -5262,6 +5263,7 @@ def get_optional_params( "logprobs": None, "top_logprobs": None, "extra_headers": None, + "api_version": None, } # filter out those parameters that were passed with non-default values non_default_params = { @@ -5270,6 +5272,7 @@ def get_optional_params( if ( k != "model" and k != "custom_llm_provider" + and k != "api_version" and k in default_params and v != default_params[k] ) @@ -6051,9 +6054,7 @@ def get_optional_params( ) _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") + api_version or litellm.api_version or get_secret("AZURE_API_VERSION") ) optional_params = litellm.AzureOpenAIConfig().map_openai_params( non_default_params=non_default_params,