Make realtime shared settings warn, raise or ignore like standard `ModelSettings`: forced `tool_choice` raises on Gemini Live, `parallel_tool_calls=False` warns
Merged
DO
1mo ago+477+477+012345678901234567890123456789-189-189-012345678901234567890123456789
Written by Claude (Douwe's coding agent) at Douwe's request.
Realtime shared settings now follow the policy #10508 set for standard models: tuning knobs a provider can't apply are ignored silently, guarantee settings warn with UnsupportedSettingWarning, and a tool_choice that forces a tool call raises. Before this, each realtime provider made its own call: GPT-Live raised for max_tokens, while Gemini quietly dropped a forced tool_choice.
[!WARNING]
Compatibility impact:
- Gemini Live: a
tool_choice of 'required' now raises UserError before connecting; until now it was ignored. A list of tool names now raises as well; it used to be treated as an allow-list.
- New
UnsupportedSettingWarnings, which fail under -W error:
parallel_tool_calls=False with function tools, on xAI, Gemini, Eleven Realtime and ElevenLabs Agents.
async_tool_calls=False with function tools, on models whose tool calls are always asynchronous.
- A
reconnect policy on ElevenLabs Agents. This used to raise UserError.
Why this can ship in a minor release:
- Gemini can't express a forced tool choice (
LiveConnectConfig/LiveClientSetup have no tool_config), so the session never did what the setting asked. Every other realtime provider already raises for it, and standard models raise for an explicit forcing tool_choice they can't honor (supports_forced_tool_choice).
- The warnings are the ones #10508 added for standard models.
Migration:
- On Gemini, use
tool_choice=ToolOrOutput(function_tools=[...]) to restrict the tools, which is what a list of names did before.
- Drop the ignored setting, or filter
UnsupportedSettingWarning.
The rule (from #10508 and the forced-tool-choice profile flags)
| Kind | Standard model | Realtime, after this PR |
|---|---|---|
Tuning knob (max_tokens, thinking, TurnDetection knobs, a pinned transcription model) | ignored silently | ignored silently |
Guarantee (parallel_tool_calls=False/async_tool_calls=False with function tools, reconnect) | UnsupportedSettingWarning, via Model.unsupported_settings | UnsupportedSettingWarning, via RealtimeModel.unsupported_settings (plus the profile's async_tool_call_mode) and the same helper |
Explicit forcing tool_choice the model can't honor | UserError | UserError on every provider |
Before → after
| Setting | OpenAI | Azure | xAI | Gemini | GPT-Live | Eleven Realtime | ElevenLabs Agents |
|---|---|---|---|---|---|---|---|
max_tokens | ok | ok | ignored | ok | raise → ignored | ok | ignored |
parallel_tool_calls=False | ok | ok | silent → warn | silent → warn | ok | silent → warn | silent → warn |
forcing tool_choice | raise | raise | raise | ignored → raise | raise | raise | raise |
input_transcription_model=None | off | off | off | off | ignored | ignored | raise → ignored |
pinned input_transcription_model | ok | ok | ok | ignored | raise → ignored | raise → ignored | ignored |
turn_detection=True | ok | ok | ok | ok | raise → ok | ok | ok |
TurnDetection knobs | ok | ok | ok | ok | raise → ignored | ok | raise → ignored |
reconnect | ok | ok | ok | ok | ok | ok | raise → warn (a drop still ends the session) |
async_tool_calls=False on an always-async model (Gemini 3.1 Flash Live, for example) goes from silent → warn.
Unchanged on purpose:
turn_detection=Falsestill raises where the provider owns turn-taking (Gemini, GPT-Live, ElevenLabs Agents), since push-to-talk can't be provided there.output_modality='text'on a speech-only model still raises.input_transcription_model=Noneon providers that always transcribe stays silent.
Mechanism
RealtimeModel.unsupported_settings, typed by the newRealtimeModelSettingName, mirrorsModel.unsupported_settings.Model.prepare_request's loop moved into_unsupported_settings.warn_unsupported_settings, which now takes the guarantee set, so standard and realtime models share one implementation. The realtime session calls it once, before connecting, with the merged settings.- A shared
reject_forced_tool_choiceinrealtime/_utils.pyreplaces the four copies of the forced-choice check (OpenAI protocol, GPT-Live, ElevenLabs Agents, and the new Gemini one).
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver.
- PR title is fit for the release changelog.
🤖 Generated with Claude Code