[Bug]: Bedrock Nova Sonic realtime leaks barge-in marker { "interrupted" : true } as literal response.text.delta content
What happened?
When a user interrupts (barge-in) during a Bedrock Nova Sonic realtime session via the proxy WebSocket (/v1/realtime?model=bedrock/amazon.nova-2-sonic-v1:0), Nova Sonic emits a textOutput event whose content is the literal JSON marker:
BedrockRealtimeTransformation.transform_text_output_event (litellm/llms/bedrock/realtime/transformation.py) passes textOutput content through verbatim into response.text.delta, so clients receive the marker as if it were model-generated text, interleaved with real response text:
okay here is the answer{ "interrupted" : true }okay here is the answer...
(Interrupted responses then restart from the beginning, so clients also see duplicated text — see companion issue about user-transcription/role handling.)
Expected behavior
The marker should be translated to OpenAI Realtime interruption semantics (e.g. cancel/truncate the in-progress response, or emit interruption signaling) — or at minimum be filtered out of response.text.delta content, since it is a Nova Sonic protocol control marker, not model output.
Steps to Reproduce
- Register
bedrock/amazon.nova-2-sonic-v1:0 on the proxy with model_info.mode: realtime.
- Connect to
ws://proxy/v1/realtime?model=<alias>, send session.update with instructions, stream mic audio (input_audio_buffer.append, PCM16 16 kHz).
- Speak, then interrupt the model while it is responding.
- Observe
response.text.delta events containing the literal { "interrupted" : true } string.
LiteLLM version
v1.98.0 (proxy)
[Bug]: Bedrock Nova Sonic realtime leaks barge-in marker
{ "interrupted" : true }as literal response.text.delta contentWhat happened?
When a user interrupts (barge-in) during a Bedrock Nova Sonic realtime session via the proxy WebSocket (
/v1/realtime?model=bedrock/amazon.nova-2-sonic-v1:0), Nova Sonic emits atextOutputevent whose content is the literal JSON marker:BedrockRealtimeTransformation.transform_text_output_event(litellm/llms/bedrock/realtime/transformation.py) passestextOutputcontent through verbatim intoresponse.text.delta, so clients receive the marker as if it were model-generated text, interleaved with real response text:(Interrupted responses then restart from the beginning, so clients also see duplicated text — see companion issue about user-transcription/role handling.)
Expected behavior
The marker should be translated to OpenAI Realtime interruption semantics (e.g. cancel/truncate the in-progress response, or emit interruption signaling) — or at minimum be filtered out of
response.text.deltacontent, since it is a Nova Sonic protocol control marker, not model output.Steps to Reproduce
bedrock/amazon.nova-2-sonic-v1:0on the proxy withmodel_info.mode: realtime.ws://proxy/v1/realtime?model=<alias>, sendsession.updatewithinstructions, stream mic audio (input_audio_buffer.append, PCM16 16 kHz).response.text.deltaevents containing the literal{ "interrupted" : true }string.LiteLLM version
v1.98.0 (proxy)