feat(elevenlabs): map wav response_format to wav_44100 in TTS (#47923)

This commit is contained in:
ryder777777 2026-10-22 14:12:40 +00:00
parent f2118fc767
commit c01e9b117f
2 changed files with 18 additions and 1 deletions

View file

@ -58,7 +58,8 @@ class ElevenLabsTextToSpeechConfig(BaseTextToSpeechConfig):
"mp3": "mp3_44100_128",
"pcm": "pcm_44100",
"opus": "opus_48000_128",
# ElevenLabs does not support WAV, AAC, or FLAC formats.
"wav": "wav_44100",
# ElevenLabs does not support AAC or FLAC formats.
}
ELEVENLABS_QUERY_PARAMS_KEY = "__elevenlabs_query_params__"

View file

@ -55,3 +55,19 @@ def test_speech_keeps_an_internal_prefixed_kwarg_out_of_the_elevenlabs_request(r
sent: Final = json.loads(respx_mock.calls[0].request.content)
assert "_litellm_undeclared_sentinel" not in sent, sent
assert sent["text"] == "hi"
def test_map_openai_params_maps_wav_response_format() -> None:
config: Final = ElevenLabsTextToSpeechConfig()
kwargs: Final[dict[str, object]] = {}
mapped_voice, _ = config.map_openai_params(
model="eleven_multilingual_v2",
optional_params={"response_format": "wav"},
voice="alloy",
kwargs=kwargs,
)
assert mapped_voice == config.VOICE_MAPPINGS["alloy"]
assert kwargs[config.ELEVENLABS_QUERY_PARAMS_KEY] == {"output_format": "wav_44100"}