From 295a9e6e138b293da0af4e068c8940c709ca0272 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 23 May 2026 00:45:57 +0000 Subject: [PATCH] fix(gemini realtime): promote nested turn_detection when flat value is not a dict When the session payload had `turn_detection: None` (or any non-dict value), the normalizer skipped promoting the GA nested `audio.input.turn_detection` because it only checked key presence. The stale None then flowed into `map_automatic_turn_detection` and raised TypeError on `'create_response' in value`. Co-authored-by: Yassin Kortam --- litellm/llms/gemini/realtime/transformation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm/llms/gemini/realtime/transformation.py b/litellm/llms/gemini/realtime/transformation.py index 0d4a35db71e..2a40bab7657 100644 --- a/litellm/llms/gemini/realtime/transformation.py +++ b/litellm/llms/gemini/realtime/transformation.py @@ -295,7 +295,9 @@ class GeminiRealtimeConfig(BaseRealtimeConfig): extracted_turn_detection = GeminiRealtimeConfig._extract_turn_detection( normalized ) - if extracted_turn_detection is not None and "turn_detection" not in normalized: + if extracted_turn_detection is not None and not isinstance( + normalized.get("turn_detection"), dict + ): normalized["turn_detection"] = extracted_turn_detection return normalized