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.
This commit is contained in:
Akhil Sanjay Potdar 2026-09-04 23:03:19 -04:00
parent f015c67f13
commit 5ad7f8dcd2
2 changed files with 3 additions and 46 deletions

View file

@ -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",

View file

@ -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