From 8cf3f4eda1455207daf17ad2ca1be175f2992f9b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 22 May 2026 19:06:38 +0000 Subject: [PATCH] fix(vertex_ai realtime): keep VAD enabled when guardrails inject create_response: False map_automatic_turn_detection sets disabled=True whenever create_response is absent OR False. Transcription guardrails inject create_response: False to suppress auto-responses while expecting VAD to stay active, but the previous override in _build_vertex_ai_setup_config only fired when create_response was absent, leaving disabled=True and silently breaking speech detection and transcription events. Vertex Live has no 'VAD on, no auto-response' mode, so always keep VAD active in the setup config. Co-authored-by: Yassin Kortam --- litellm/llms/vertex_ai/realtime/transformation.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/litellm/llms/vertex_ai/realtime/transformation.py b/litellm/llms/vertex_ai/realtime/transformation.py index e3a718b45f4..91d503503d8 100644 --- a/litellm/llms/vertex_ai/realtime/transformation.py +++ b/litellm/llms/vertex_ai/realtime/transformation.py @@ -178,16 +178,19 @@ class VertexAIRealtimeConfig(GeminiRealtimeConfig): # Ensure Vertex defaults for realtimeInputConfig apply even when # the client provided a partial ``turn_detection`` (e.g. only - # ``silence_duration_ms``). ``map_openai_params`` defaults - # ``disabled=True`` when ``create_response`` is absent, which would - # otherwise silently disable VAD here. + # ``silence_duration_ms``). ``map_automatic_turn_detection`` sets + # ``disabled=True`` whenever ``create_response`` is absent or + # ``False`` — the latter being how transcription guardrails + # suppress automatic responses — which would otherwise silently + # disable VAD here and break speech detection / transcription + # events. Vertex Live has no "VAD on, no auto-response" mode, so + # always keep VAD active; ``create_response: True`` already maps + # to ``disabled=False`` and is therefore unaffected. realtime_input_config = setup_config.setdefault("realtimeInputConfig", {}) automatic_detection = realtime_input_config.setdefault( "automaticActivityDetection", {} ) - client_turn_detection = self._extract_turn_detection(session_params) or {} - if "create_response" not in client_turn_detection: - automatic_detection["disabled"] = False + automatic_detection["disabled"] = False automatic_detection.setdefault("silenceDurationMs", 800) setup_config.setdefault("inputAudioTranscription", {})