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:
from 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
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 callsubmit) usinggit statusorgit diffcommands. 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 inspect the repository structure and the OpenAI realtime implementation, then trace how session updates are built and how constructor options are typed/documented. I’ll implement the smallest compatible API change, run focused tests (and broader relevant tests if available), inspect the diff, and submit only after verification.
- Assistant
The installed OpenAI SDK already defines
RealtimeSessionCreateRequest.reasoningand supports the documented effort literals, so this is an API-plumbing gap rather than an SDK compatibility issue. I’ll retain the plugin’s existingNotGivensemantics, store the option in the realtime options snapshot, include it in initial/reconnect session updates, and allow changing it throughupdate_optionsso the behavior is consistent with other session settings. - Assistant
The focused reproduction now constructs
RealtimeModel(model="gpt-realtime-2", reasoning={"effort": "low"}), reads the first queued session update, and confirms the payload containssession.reasoning.effort == "low". Lint and compilation also pass. I’m doing a final diff review for accidental API/signature issues and checking repository status before submission.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.