From fe24b9d90b95012ac030f6919a766cbeab1b1ae3 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Wed, 19 Mar 2025 16:20:30 -0700 Subject: [PATCH] feat(azure/gpt_transformation.py): add azure audio model support Closes https://github.com/BerriAI/litellm/issues/6305 --- litellm/llms/azure/chat/gpt_transformation.py | 2 ++ litellm/llms/openai/chat/gpt_transformation.py | 1 + tests/llm_translation/test_optional_params.py | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/litellm/llms/azure/chat/gpt_transformation.py b/litellm/llms/azure/chat/gpt_transformation.py index 7aa4fffab5..ee85517e66 100644 --- a/litellm/llms/azure/chat/gpt_transformation.py +++ b/litellm/llms/azure/chat/gpt_transformation.py @@ -99,6 +99,8 @@ class AzureOpenAIConfig(BaseConfig): "extra_headers", "parallel_tool_calls", "prediction", + "modalities", + "audio", ] def _is_response_format_supported_model(self, model: str) -> bool: diff --git a/litellm/llms/openai/chat/gpt_transformation.py b/litellm/llms/openai/chat/gpt_transformation.py index 8974a2a074..c765f97979 100644 --- a/litellm/llms/openai/chat/gpt_transformation.py +++ b/litellm/llms/openai/chat/gpt_transformation.py @@ -125,6 +125,7 @@ class OpenAIGPTConfig(BaseLLMModelInfo, BaseConfig): "max_retries", "extra_headers", "parallel_tool_calls", + "audio", ] # works across all models model_specific_params = [] diff --git a/tests/llm_translation/test_optional_params.py b/tests/llm_translation/test_optional_params.py index ad698e54c7..f59d434902 100644 --- a/tests/llm_translation/test_optional_params.py +++ b/tests/llm_translation/test_optional_params.py @@ -1368,3 +1368,14 @@ def test_bedrock_invoke_anthropic_max_tokens(): assert "max_tokens_to_sample" not in optional_params assert optional_params["max_tokens"] == 1024 + + +def test_azure_modalities_param(): + optional_params = get_optional_params( + model="chatgpt-v2", + custom_llm_provider="azure", + modalities=["text", "audio"], + audio={"type": "audio_input", "input": "test.wav"}, + ) + assert optional_params["modalities"] == ["text", "audio"] + assert optional_params["audio"] == {"type": "audio_input", "input": "test.wav"}