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
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 inspect the repository for the Python OpenAI realtime plugin, trace how session update payloads and constructor options are typed, then implement the smallest compatible API change. I’ll run the affected tests (and a focused payload check if needed), review the diff, and submit only after verification.
- Assistant
The realtime session model in the installed OpenAI SDK does not declare
reasoning, but it permits extra fields, so the payload can still carry the API field. I’ll expose a typedreasoningoption (accepting the SDKReasoningmodel or the dict form shown in the issue), persist it in model/session options, include it in the initialsession.update, and support live option updates consistently with the other session settings. Azure conversion will preserve the field when present. - Assistant
The focused verification now confirms
RealtimeModel(model="gpt-realtime-2", reasoning={"effort": "low"})stores the option and emitssession.reasoning == {"effort": "low"}. Ruff, compilation, and diff checks pass. The broader realtime test module was collected successfully, but execution cannot start its live OpenAI fixture because this environment has no API key; that is an external test-environment failure rather than a code failure. I also fixed the Azure factory forwarding and preserved reasoning during Azure payload conversion.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.