The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix using azure openai clients
Ishaan Jaffc1e0cb136e04
diff --git a/litellm/llms/azure/audio_transcriptions.py b/litellm/llms/azure/audio_transcriptions.pyindex 52a3d780fbd..6daeff75e35 100644--- a/litellm/llms/azure/audio_transcriptions.py+++ b/litellm/llms/azure/audio_transcriptions.py@@ -14,6 +14,7 @@ from litellm.utils import ()from .azure import AzureChatCompletion+from .common_utils import AzureOpenAIErrorclass AzureAudioTranscription(AzureChatCompletion):@@ -36,15 +37,6 @@ class AzureAudioTranscription(AzureChatCompletion):) -> TranscriptionResponse:data = {"model": model, "file": audio_file, **optional_params}- # init AzureOpenAI Client- azure_client_params = self.initialize_azure_sdk_client(- litellm_params=litellm_params or {},- api_key=api_key,- model_name=model,- api_version=api_version,- api_base=api_base,- )-if atranscription is True:return self.async_audio_transcriptions( # type: ignoreaudio_file=audio_file,@@ -54,14 +46,24 @@ class AzureAudioTranscription(AzureChatCompletion):api_key=api_key,api_base=api_base,client=client,- azure_client_params=azure_client_params,max_retries=max_retries,logging_obj=logging_obj,)- if client is None:- azure_client = AzureOpenAI(http_client=litellm.client_session, **azure_client_params) # type: ignore- else:- azure_client = client++ azure_client = self.get_azure_openai_client(+ api_version=api_version,+ api_base=api_base,+ api_key=api_key,+ model=model,+ _is_async=False,+ client=client,+ litellm_params=litellm_params,+ )+ if not isinstance(azure_client, AzureOpenAI):+ raise AzureOpenAIError(+ status_code=500,+ message="azure_client is not an instance of AzureOpenAI",+ )## LOGGINGlogging_obj.pre_call(@@ -98,24 +100,34 @@ class AzureAudioTranscription(AzureChatCompletion):async def async_audio_transcriptions(self,audio_file: FileTypes,+ model: str,data: dict,model_response: TranscriptionResponse,timeout: float,- azure_client_params: dict,logging_obj: Any,+ api_version: Optional[str] = None,api_key: Optional[str] = None,api_base: Optional[str] = None,client=None,max_retries=None,+ litellm_params: Optional[dict] = None,):response = Nonetry:- if client is None:- async_azure_client = AsyncAzureOpenAI(- **azure_client_params,+ async_azure_client = self.get_azure_openai_client(+ api_version=api_version,+ api_base=api_base,+ api_key=api_key,+ model=model,+ _is_async=True,+ client=client,+ litellm_params=litellm_params,+ )+ if not isinstance(async_azure_client, AsyncAzureOpenAI):+ raise AzureOpenAIError(+ status_code=500,+ message="async_azure_client is not an instance of AsyncAzureOpenAI",)- else:- async_azure_client = client## LOGGINGlogging_obj.pre_call(