[Voxtral] Raise BadRequest for ref_audio (#7012)

Signed-off-by: Clodagh Walsh <clodaghwalsh17@gmail.com>
This commit is contained in:
Clodagh Walsh authored and GitHub committed 2026-09-15 18:26:08 -07:00
1 parent 45a3e77351
commit a1a234a0b4
7 files changed
+68 -4

No files matched your search

@@ -12,11 +12,14 @@ import os
os.environ.setdefault("VLLM_WORKER_MULTIPROC_METHOD", "spawn")
import pytest
from openai import BadRequestError as OpenAIBadRequestError
from tests.helpers.mark import hardware_test
from tests.helpers.media import generate_synthetic_audio
from tests.helpers.runtime import OmniServerParams
from tests.helpers.stage_config import get_deploy_config_path
# Note this model is the public checkpoint without the encoder weights required for voice cloning
MODEL = "mistralai/Voxtral-4B-TTS-2603"
STAGE_CONFIG = get_deploy_config_path("voxtral_tts.yaml")
EXTRA_ARGS = ["--trust-remote-code", "--enforce-eager", "--disable-log-stats"]
@@ -173,3 +176,21 @@ def test_speech_batches(omni_server, online_client) -> None:
"timeout": 120.0,
}
)
@hardware_test(res={"cuda": "L4"}, num_cards=1)
def test_speech_ref_audio(omni_server, online_client) -> None:
"""Test ref_audio failure is handled as a BadRequest instead of a RuntimeError"""
audio_data = f"data:audio/wav;base64,{generate_synthetic_audio(5, 1)['base64']}"
with pytest.raises(OpenAIBadRequestError) as exc_info:
online_client.send_audio_speech_request(
{
"model": omni_server.model,
"input": "how are you",
"ref_audio": audio_data,
"language": "English",
"response_format": "wav",
}
)
assert exc_info.value.status_code == 400