From ac9aa1ab67859d47f3f4ae50996bc4e0e16892b9 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Wed, 14 Aug 2024 15:47:57 -0700 Subject: [PATCH] Use AZURE_API_VERSION as default azure openai version Without this change, the default version of the Azure OpenAI API is hardcoded in the code as an old version, `"2024-02-01"`. This change allows the user to set the default version of the Azure OpenAI API by setting the environment variable `AZURE_API_VERSION` or by using the command-line parameter `--api_version`. --- litellm/router_utils/client_initalization_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/router_utils/client_initalization_utils.py b/litellm/router_utils/client_initalization_utils.py index 073a87901a..f396defb51 100644 --- a/litellm/router_utils/client_initalization_utils.py +++ b/litellm/router_utils/client_initalization_utils.py @@ -190,7 +190,7 @@ def set_client(litellm_router_instance: LitellmRouter, model: dict): if azure_ad_token.startswith("oidc/"): azure_ad_token = get_azure_ad_token_from_oidc(azure_ad_token) if api_version is None: - api_version = litellm.AZURE_DEFAULT_API_VERSION + api_version = os.getenv("AZURE_API_VERSION", litellm.AZURE_DEFAULT_API_VERSION) if "gateway.ai.cloudflare.com" in api_base: if not api_base.endswith("/"):