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
The installed OpenAI SDK (2.40.0) already has a
reasoningfield onRealtimeSessionCreateRequest. Let me check its type: - Assistant
RealtimeReasoningwas added in openai SDK 2.36.0, but the plugin pinsopenai[realtime]>=2. Let me check how the repo has handled this before: - Assistant
Both are exported. Now implementing. First the converter in
utils.py: - Assistant
Now
realtime_model.py. Imports first: - Assistant
Now
_RealtimeOptions: - Assistant
Now the two overloads and the implementation signature:
- Assistant
Now
RealtimeModel.update_optionsand the fan-out to sessions: - Assistant
Now
_create_session_update_eventandRealtimeSession.update_options: - Assistant
Now bump the openai dependency floor since
RealtimeReasoningwas added in openai 2.36.0: - Assistant
Now verify. Quick functional check of the session.update payload:
- Assistant
All paths work. Now run lint/format/type checks:
- Assistant
Now check for existing tests covering the realtime plugin:
- Assistant
Now add unit tests to
tests/test_config.py: - Assistant
The
Chan.qsizecheck passed too. Now update the lockfile for the pin bump: - Assistant
Done.
reasoning.effortis now supported onopenai.realtime.RealtimeModel, exactly as in the feature request:pythonllm = openai.realtime.RealtimeModel( model="gpt-realtime-2", reasoning={"effort": "low"}, # also accepts "low" or RealtimeReasoning(effort="low") )
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.