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 structure and the OpenAI realtime implementation, then trace session-update payload construction and existing tests. I’ll add the smallest API/payload change consistent with project conventions, run targeted tests (and broader relevant tests if available), review the diff, and submit only after verification.
- Assistant
The current constructor accepts unknown keywords via
**kwargs, soreasoningis silently ignored; the session payload also never sets it. The installed OpenAI SDK providesRealtimeReasoningwith exactly the documented effort literals. I’ll expose that type (while accepting a dict as in the requested example), normalize it once into the SDK model, retain it in realtime options, and include it in initialsession.updatepayloads. I’ll avoid changing mutable update behavior because the request is for model configuration and reasoning is not currently represented as a mutable option. - Assistant
The implementation now carries reasoning through the model options and initial session construction. I’ll verify both the requested dict form and the typed SDK form, confirm omission when not provided, and run formatting/type or targeted test tooling available in the repository.
- Assistant
Verification succeeded: the requested dict produces
{"reasoning": {"effort": "low"}}, typedRealtimeReasoningworks (includingxhigh), and the field is omitted by default. Compilation andtests/test_config.pypass;ruffis not installed, so I also usedgit diff --check. I’ll make one small import-order cleanup, recheck the final diff, then submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.