From 5ad7f8dcd28f2e1c87a1f3cdb09a060be17eff54 Mon Sep 17 00:00:00 2001 From: Akhil Sanjay Potdar Date: Fri, 4 Sep 2026 23:03:19 -0400 Subject: [PATCH] fix(bedrock): trim comment verbosity, drop dispatch-boundary test Shorten the two comments added for the system-message fix to one line each, per this repo's comment policy in litellm-rust/CLAUDE.md. Remove test_bedrock_transcription_dispatch_adds_no_system_message: it mocks out the entire Rust bridge call, so it never exercises the request body construction where the bug and the fix both live. The Rust test request_omits_system_message_alongside_audio_content already covers this by calling transform_transcription_request directly and asserting on its output. --- .../providers/bedrock/audio_transcription.rs | 15 ++------ .../test_audio_transcription_rust_bridge.py | 34 ------------------- 2 files changed, 3 insertions(+), 46 deletions(-) diff --git a/litellm-rust/crates/core/src/providers/bedrock/audio_transcription.rs b/litellm-rust/crates/core/src/providers/bedrock/audio_transcription.rs index a33670c5113..123a8feccbc 100644 --- a/litellm-rust/crates/core/src/providers/bedrock/audio_transcription.rs +++ b/litellm-rust/crates/core/src/providers/bedrock/audio_transcription.rs @@ -70,12 +70,8 @@ impl AudioTranscriptionProviderConfig for BedrockAudioTranscriptionConfig { if let Some(temperature) = optional_params.get("temperature") { inference_config.insert("temperature".to_string(), temperature.clone()); } - // Bedrock's Converse API rejects a `system` block on any request that - // also carries an audio content block (HTTP 400: "Found system - // messages ... and audio chunks ... This is not allowed prior to the - // tokenizer version 13."). Voxtral takes the transcription - // instruction from the user turn's `text` block above, so no system - // prompt is needed here. + // Bedrock 400s if `system` accompanies audio content; Voxtral gets + // its instruction from the `text` block above instead. Ok(AudioTranscriptionRequestData { body: json!({ "messages": [{ @@ -191,12 +187,7 @@ mod tests { #[test] fn request_omits_system_message_alongside_audio_content() { - // Regression test: Bedrock's Converse API 400s on a `system` block - // combined with an audio content block ("Found system messages ... - // and audio chunks ... This is not allowed prior to the tokenizer - // version 13."). Confirmed against live Bedrock that dropping - // `system` while keeping everything else identical makes the - // request succeed. + // Regression test: Bedrock 400s if `system` accompanies audio content. let result = BEDROCK_AUDIO_TRANSCRIPTION_CONFIG .transform_transcription_request( "mistral.voxtral-mini-3b-2507", diff --git a/tests/test_litellm/test_audio_transcription_rust_bridge.py b/tests/test_litellm/test_audio_transcription_rust_bridge.py index 40ea20c17ef..bbeb6c38f78 100644 --- a/tests/test_litellm/test_audio_transcription_rust_bridge.py +++ b/tests/test_litellm/test_audio_transcription_rust_bridge.py @@ -149,37 +149,3 @@ async def test_bedrock_atranscription_uses_rust_only_path() -> None: rust_bridge.configure_rust_transcription(transcription=None, atranscription=None) assert response.text == "rust" - - -def test_bedrock_transcription_dispatch_adds_no_system_message() -> None: - """Guard the Python/Rust dispatch boundary for the Bedrock Voxtral fix. - - Bedrock's Converse API rejects a request that carries both a `system` - block and an audio content block. The fix removes that `system` block - from the request the Rust transform builds (see - litellm-rust/crates/core/src/providers/bedrock/audio_transcription.rs), - since this dispatch layer mocks the whole bridge callable and never sees - that internal JSON. This test instead pins the boundary Python does - control: it must not hand the bridge a `system` message (directly or via - optional_params) that could reintroduce the same conflict from this side. - """ - captured: dict[str, object] = {} - - def capture(**kwargs: object) -> dict[str, object]: - captured.update(kwargs) - return {"text": "ok"} - - rust_bridge.configure_rust_transcription(transcription=capture, atranscription=None) - try: - litellm.transcription( - model="bedrock/mistral.voxtral-mini-3b-2507", - file=("audio.wav", b"audio", "audio/wav"), - language="en", - ) - finally: - rust_bridge.configure_rust_transcription(transcription=None, atranscription=None) - - assert "system" not in captured - optional_params = captured.get("optional_params") - assert isinstance(optional_params, dict) - assert "system" not in optional_params