diff --git a/litellm/llms/deepgram/audio_transcription/transformation.py b/litellm/llms/deepgram/audio_transcription/transformation.py index 95bdd406c3f..dc70e8509aa 100644 --- a/litellm/llms/deepgram/audio_transcription/transformation.py +++ b/litellm/llms/deepgram/audio_transcription/transformation.py @@ -215,19 +215,16 @@ class DeepgramAudioTranscriptionConfig(BaseAudioTranscriptionConfig): Returns: Dictionary of filtered and formatted query parameters """ - query_params: Final = {} + supported_openai_params: Final = self.get_supported_openai_params(model) provider_specific_params: Final = self.get_provider_specific_params( optional_params=optional_params, model=model, - openai_params=self.get_supported_openai_params(model), + openai_params=supported_openai_params, ) + openai_params: Final = {key: value for key, value in optional_params.items() if key in supported_openai_params} + query_params: Final = {**provider_specific_params, **openai_params} - for key, value in provider_specific_params.items(): - # Format and add the parameter - formatted_value = self._format_param_value(value) - query_params[key] = formatted_value - - return query_params + return {key: self._format_param_value(value) for key, value in query_params.items()} def validate_environment( self, diff --git a/tests/test_litellm/llms/deepgram/audio_transcription/test_deepgram_audio_transcription_transformation.py b/tests/test_litellm/llms/deepgram/audio_transcription/test_deepgram_audio_transcription_transformation.py index 7c1f5256deb..dab12093f4f 100644 --- a/tests/test_litellm/llms/deepgram/audio_transcription/test_deepgram_audio_transcription_transformation.py +++ b/tests/test_litellm/llms/deepgram/audio_transcription/test_deepgram_audio_transcription_transformation.py @@ -148,22 +148,20 @@ def test_get_complete_url_with_multiple_params(): def test_get_complete_url_with_language_parameter(): - """Test that language parameter is excluded from query string (handled separately)""" + """Test that language parameter is included in the query string""" handler = DeepgramAudioTranscriptionConfig() url = handler.get_complete_url( api_base=None, api_key=None, model="nova-2", optional_params={ - "language": "en", + "language": "zh", "punctuate": True, }, litellm_params={}, ) - expected_url = "https://api.deepgram.com/v1/listen?model=nova-2&punctuate=true" + expected_url = "https://api.deepgram.com/v1/listen?model=nova-2&punctuate=true&language=zh" assert url == expected_url - # Language should NOT appear in URL as it's handled separately - assert "language=" not in url def test_get_complete_url_with_custom_api_base(): diff --git a/tests/test_litellm/llms/deepgram/test_deepgram_mock_transcription.py b/tests/test_litellm/llms/deepgram/test_deepgram_mock_transcription.py index e12b3982b13..5d725500ce1 100644 --- a/tests/test_litellm/llms/deepgram/test_deepgram_mock_transcription.py +++ b/tests/test_litellm/llms/deepgram/test_deepgram_mock_transcription.py @@ -122,10 +122,10 @@ class TestDeepgramMockTranscription: {"version": "latest"}, "https://api.deepgram.com/v1/listen?model=nova-2&version=latest", ), - # Language parameter should be excluded + # Language parameter should be included ( {"language": "en", "punctuate": True}, - "https://api.deepgram.com/v1/listen?model=nova-2&punctuate=true", + "https://api.deepgram.com/v1/listen?model=nova-2&punctuate=true&language=en", ), # Multiple parameters with boolean conversion (