This commit is contained in:
IvanShang 2026-08-27 16:34:16 -04:00 committed by GitHub
commit e8325121fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 27 deletions

View file

@ -8,7 +8,6 @@ import httpx
from httpx import Response
import litellm
from litellm._logging import verbose_logger
from litellm.litellm_core_utils.prompt_templates.common_utils import (
_audio_or_image_in_message_content,
convert_content_list_to_str,
@ -204,21 +203,6 @@ class AzureAIStudioConfig(OpenAIConfig):
message["content"] = texts
return stripped_messages
def _is_azure_openai_model(self, model: str, api_base: str | None) -> bool:
try:
if "/" in model:
model = model.split("/", 1)[1]
if (
model in litellm.open_ai_chat_completion_models
or model in litellm.open_ai_text_completion_models
or model in litellm.open_ai_embedding_models
):
return True
except Exception:
return False
return False
def _get_openai_compatible_provider_info(
self,
model: str,
@ -228,10 +212,6 @@ class AzureAIStudioConfig(OpenAIConfig):
) -> tuple[str | None, str | None, str]:
api_base = api_base or get_secret_str("AZURE_AI_API_BASE")
dynamic_api_key: Final = api_key or get_secret_str("AZURE_AI_API_KEY")
if self._is_azure_openai_model(model=model, api_base=api_base):
verbose_logger.debug("Model=%s is Azure OpenAI model. Setting custom_llm_provider='azure'.", model)
custom_llm_provider = "azure"
return api_base, dynamic_api_key, custom_llm_provider
def transform_request(

View file

@ -10,11 +10,8 @@ from litellm.llms.azure_ai.chat.transformation import AzureAIStudioConfig
@pytest.mark.asyncio
async def test_get_openai_compatible_provider_info():
"""
Test that Azure AI requests are formatted correctly with the proper endpoint and parameters
for both synchronous and asynchronous calls
"""
async def test_azure_ai_openai_model_keeps_azure_ai_provider():
"""OpenAI-named Azure AI deployments must retain Azure AI pricing identity."""
config = AzureAIStudioConfig()
(
@ -22,13 +19,13 @@ async def test_get_openai_compatible_provider_info():
dynamic_api_key,
custom_llm_provider,
) = config._get_openai_compatible_provider_info(
model="azure_ai/gpt-4o-mini",
model="azure_ai/gpt-5.4-nano",
api_base="https://my-base",
api_key="my-key",
custom_llm_provider="azure_ai",
)
assert custom_llm_provider == "azure"
assert custom_llm_provider == "azure_ai"
def test_azure_ai_validate_environment():