ISSUE DESCRIPTION Add reasoning.effort support for OpenAI gpt-realtime-2 Feature Type…
- User
ISSUE DESCRIPTION
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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Assistant
I'll explore the repository to find the OpenAI realtime plugin and how session options are currently passed.
- Assistant
I'll inspect the OpenAI realtime plugin source and any existing reasoning-related types.
- Assistant
Let me use grep instead of rg.
- Assistant
I'll open the RealtimeModel class and session-update code to see how options are wired.
- Assistant
Let me continue reading the init method and also the options dataclass.
- Assistant
I'll inspect
_RealtimeOptionsand session-update construction next. - Assistant
Let me check the RealtimeSessionCreateRequestParam for reasoning field.
- Assistant
I'll read how session updates are built and how similar options like truncation are handled.
- Assistant
I'll read imports and the full session-create / update_options paths to mirror how truncation is wired.
- Assistant
I'll check RealtimeReasoning types and the full update_options and with_azure methods.
- Assistant
I'll review Azure session mapping and session update / update_options implementation next.
- Assistant
Let me read the full _create_session_update_event and RealtimeSession.update_options
- Assistant
I'll check whether any existing helpers normalize similar nested options.
- Assistant
Implementing
reasoningsupport by mirroring howtruncationis handled across options, init, and session updates. - Assistant
I'll navigate to the import section and apply the edit.
- Assistant
Now I can use replace while the file is open at that location.
- Assistant
I'll add a
to_reasoninghelper and includereasoningon_RealtimeOptions. - Assistant
Now update _RealtimeOptions.
- Assistant
Need to navigate first
- Assistant
Good, now I can edit.
- Assistant
I'll add
reasoningto both__init__overloads and the implementation. - Assistant
Continue with azure overload and actual init
- Assistant
Next I'll update the docstring and
_optsconstruction. - Assistant
Now update the _opts construction
- Assistant
Let me update _opts and also with_azure/update_options.
- Assistant
I'll add
reasoningto bothupdate_optionsmethods and wire it into the session update event. - Assistant
I'll update RealtimeModel.update_options
- Assistant
Now update session create event and session-level update_options.
- Assistant
Continue reading truncation part of session update_options
- Assistant
Now update RealtimeSession.update_options to handle reasoning.
- Assistant
I'll verify the change with a local script that builds a session-update event and checks the reasoning payload.
- Assistant
I'll rerun the check under an asyncio event loop.
- Assistant
I'll scan for other
_RealtimeOptionsconstructions and review the full diff.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.