diff --git a/litellm/llms/azure/common_utils.py b/litellm/llms/azure/common_utils.py index 8581339d88..5764fcdd1b 100644 --- a/litellm/llms/azure/common_utils.py +++ b/litellm/llms/azure/common_utils.py @@ -694,6 +694,7 @@ class BaseAzureLLM(BaseOpenAILLM): api_base: Optional[str], litellm_params: Optional[Union[GenericLiteLLMParams, Dict[str, Any]]], route: Literal["/openai/responses", "/openai/vector_stores"], + default_api_version: Optional[str] = None, ) -> str: from litellm.constants import AZURE_DEFAULT_RESPONSES_API_VERSION @@ -708,14 +709,14 @@ class BaseAzureLLM(BaseOpenAILLM): litellm_params = litellm_params or {} api_version = ( cast(Optional[str], litellm_params.get("api_version")) - or AZURE_DEFAULT_RESPONSES_API_VERSION + or default_api_version ) # Create a new dictionary with existing params query_params = dict(original_url.params) # Add api_version if needed - if "api-version" not in query_params: + if "api-version" not in query_params and api_version: query_params["api-version"] = api_version # Add the path to the base URL diff --git a/litellm/llms/azure/responses/transformation.py b/litellm/llms/azure/responses/transformation.py index e3d37c8a15..063d1af9c3 100644 --- a/litellm/llms/azure/responses/transformation.py +++ b/litellm/llms/azure/responses/transformation.py @@ -70,8 +70,13 @@ class AzureOpenAIResponsesAPIConfig(OpenAIResponsesAPIConfig): - A complete URL string, e.g., "https://litellm8397336933.openai.azure.com/openai/responses?api-version=2024-05-01-preview" """ + from litellm.constants import AZURE_DEFAULT_RESPONSES_API_VERSION + return BaseAzureLLM._get_base_azure_url( - api_base=api_base, litellm_params=litellm_params, route="/openai/responses" + api_base=api_base, + litellm_params=litellm_params, + route="/openai/responses", + default_api_version=AZURE_DEFAULT_RESPONSES_API_VERSION, ) #########################################################