Azure Managed Batches - api key error (#14932)

* added qwen models and gpt-5-codex

* fix flaky test

* fix failing test

* Added retries to prisma client state

* fix: prisma client state retries in pods

* Revert "fix failing test"

This reverts commit dbec4988a2.

* Revert "fix flaky test"

This reverts commit b0ac2f2dc3.

* Revert "added qwen models and gpt-5-codex"

This reverts commit 9a8a8f2d47.

* Revert "fix: prisma client state retries in pods"

This reverts commit 04e58e5ca1.

* fix lint

* Revert "fix lint"

This reverts commit 5303d52a5e.

* fixed lint

* fix: azure api key managed batch files
This commit is contained in:
Mubashir Osmani 2025-09-26 16:35:35 -04:00 committed by GitHub
parent 2973ff8be9
commit b039374c71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 10 deletions

View file

@ -62,7 +62,7 @@ class AzureBatchesAPI(BaseAzureLLM):
)
if azure_client is None:
raise ValueError(
"OpenAI client is not initialized. Make sure api_key is passed or OPENAI_API_KEY is set in the environment."
"Azure OpenAI client is not initialized. Make sure api_key is passed or AZURE_API_KEY/AZURE_OPENAI_API_KEY is set in the environment."
)
if _is_async is True:
@ -108,7 +108,7 @@ class AzureBatchesAPI(BaseAzureLLM):
)
if azure_client is None:
raise ValueError(
"OpenAI client is not initialized. Make sure api_key is passed or OPENAI_API_KEY is set in the environment."
"Azure OpenAI client is not initialized. Make sure api_key is passed or AZURE_API_KEY/AZURE_OPENAI_API_KEY is set in the environment."
)
if _is_async is True:
@ -156,7 +156,7 @@ class AzureBatchesAPI(BaseAzureLLM):
)
if azure_client is None:
raise ValueError(
"OpenAI client is not initialized. Make sure api_key is passed or OPENAI_API_KEY is set in the environment."
"Azure OpenAI client is not initialized. Make sure api_key is passed or AZURE_API_KEY/AZURE_OPENAI_API_KEY is set in the environment."
)
response = azure_client.batches.cancel(**cancel_batch_data)
return response
@ -195,7 +195,7 @@ class AzureBatchesAPI(BaseAzureLLM):
)
if azure_client is None:
raise ValueError(
"OpenAI client is not initialized. Make sure api_key is passed or OPENAI_API_KEY is set in the environment."
"Azure OpenAI client is not initialized. Make sure api_key is passed or AZURE_API_KEY/AZURE_OPENAI_API_KEY is set in the environment."
)
if _is_async is True:

View file

@ -576,8 +576,19 @@ class BaseAzureLLM(BaseOpenAILLM):
verbose_logger.debug(
f"Initializing Azure OpenAI Client for {model_name}, Api Base: {str(api_base)}, Api Key:{_api_key}"
)
# Extract API key from multiple sources with proper precedence
resolved_api_key = (
api_key
or litellm_params.get("api_key")
or litellm.api_key
or litellm.azure_key
or get_secret_str("AZURE_OPENAI_API_KEY")
or get_secret_str("AZURE_API_KEY")
)
azure_client_params = {
"api_key": api_key,
"api_key": resolved_api_key,
"azure_endpoint": api_base,
"api_version": api_version,
"azure_ad_token": azure_ad_token,

View file

@ -58,7 +58,7 @@ class AzureOpenAIFilesAPI(BaseAzureLLM):
)
if openai_client is None:
raise ValueError(
"AzureOpenAI client is not initialized. Make sure api_key is passed or OPENAI_API_KEY is set in the environment."
"Azure OpenAI client is not initialized. Make sure api_key is passed or AZURE_API_KEY/AZURE_OPENAI_API_KEY is set in the environment."
)
if _is_async is True:
@ -106,7 +106,7 @@ class AzureOpenAIFilesAPI(BaseAzureLLM):
)
if openai_client is None:
raise ValueError(
"AzureOpenAI client is not initialized. Make sure api_key is passed or OPENAI_API_KEY is set in the environment."
"Azure OpenAI client is not initialized. Make sure api_key is passed or AZURE_API_KEY/AZURE_OPENAI_API_KEY is set in the environment."
)
if _is_async is True:
@ -156,7 +156,7 @@ class AzureOpenAIFilesAPI(BaseAzureLLM):
)
if openai_client is None:
raise ValueError(
"AzureOpenAI client is not initialized. Make sure api_key is passed or OPENAI_API_KEY is set in the environment."
"Azure OpenAI client is not initialized. Make sure api_key is passed or AZURE_API_KEY/AZURE_OPENAI_API_KEY is set in the environment."
)
if _is_async is True:
@ -208,7 +208,7 @@ class AzureOpenAIFilesAPI(BaseAzureLLM):
)
if openai_client is None:
raise ValueError(
"AzureOpenAI client is not initialized. Make sure api_key is passed or OPENAI_API_KEY is set in the environment."
"Azure OpenAI client is not initialized. Make sure api_key is passed or AZURE_API_KEY/AZURE_OPENAI_API_KEY is set in the environment."
)
if _is_async is True:
@ -262,7 +262,7 @@ class AzureOpenAIFilesAPI(BaseAzureLLM):
)
if openai_client is None:
raise ValueError(
"AzureOpenAI client is not initialized. Make sure api_key is passed or OPENAI_API_KEY is set in the environment."
"Azure OpenAI client is not initialized. Make sure api_key is passed or AZURE_API_KEY/AZURE_OPENAI_API_KEY is set in the environment."
)
if _is_async is True: