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 <yassin@berri.ai>
This commit is contained in:
Cursor Agent 2026-05-23 00:45:57 +00:00
parent ef98c98a12
commit 295a9e6e13
No known key found for this signature in database

View file

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