Add reasoning.effort support for OpenAI gpt-realtime-2 Feature Type Would make my life…
- User
Add reasoning.effort support for OpenAI gpt-realtime-2
Feature Type
Would make my life easier
Feature Description
OpenAI
gpt-realtime-2supports configurable reasoning viareasoning.effort, but the Python OpenAI Realtime plugin does not seem to expose this option onopenai.realtime.RealtimeModel.It would be useful to support something like:
pythonfrom livekit.plugins import openai llm = openai.realtime.RealtimeModel( model="gpt-realtime-2", reasoning={"effort": "low"}, )Workarounds / Alternatives
I don't think there is a clean workaround through the current Python
RealtimeModelAPI.The only workaround I can see is patching the plugin locally to add
reasoningto the session update payload.Additional Context
OpenAI docs list these effort values:
minimal,low,medium,high,xhigh.References:
- https://developers.openai.com/api/docs/models/gpt-realtime-2
- https://developers.openai.com/api/docs/guides/realtime-models-prompting#set-reasoning-effort
- Related JS issue: https://github.com/livekit/agents-js/issues/1433
- Related JS PR: https://github.com/livekit/agents-js/pull/1575
Interface
No new interfaces are introduced.
- Assistant
Now let me check whether the installed
openaiSDK types supportreasoningon the realtime session: - Assistant
Now I'll implement. First, add a
to_reasoningconverter inutils.py: - Assistant
Now update
realtime_model.py. First the imports: - Assistant
Add to
_RealtimeOptions: - Assistant
Now the first overload:
- Assistant
Second (Azure) overload:
- Assistant
Now the actual
__init__signature and docstring: - Assistant
Now the
_RealtimeOptionsconstruction: - Assistant
Now
RealtimeModel.update_options: - Assistant
Now
RealtimeSession.update_options: - Assistant
Now check if the type stubs allow assigning
session.reasoning, and run checks: - Assistant
All assertions pass (connection errors are just the fake API key attempting a real WS connect — expected). Now run lint, format, and type checks:
- Assistant
No realtime wrapper in
inference/— the change is contained to the plugin. Let me check if the repo uses changesets for changelog entries: - Assistant
Done.
reasoningsupport forgpt-realtime-2is implemented in the OpenAI Realtime plugin.Changes
livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/utils.py
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.