Skip to content
TheChatArchiveThe Chat Archive
MiniMaxminimax/minimax-m3· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Add reasoning.effort support for OpenAI gpt-realtime-2 Feature Type…

  1. User

    ISSUE DESCRIPTION

    Add reasoning.effort support for OpenAI gpt-realtime-2

    Feature Type

    Would make my life easier

    Feature Description

    OpenAI gpt-realtime-2 supports configurable reasoning via reasoning.effort, but the Python OpenAI Realtime plugin does not seem to expose this option on openai.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 RealtimeModel API.

    The only workaround I can see is patching the plugin locally to add reasoning to the session update payload.

    Additional Context

    OpenAI docs list these effort values: minimal, low, medium, high, xhigh.

    References:

    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 using git reset --hard command. Additionally, you can use git stash and git stash pop to 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 submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /agents, current file: none) bash-$

  2. MiniMax Assistant

    Let me start by exploring the repository structure to understand what we're working with.

  3. MiniMax Assistant

    Let me look at the realtime_model.py file to understand its structure.

  4. MiniMax Assistant

    Let me look at the _RealtimeOptions class:

  5. MiniMax Assistant

    Now let me look at the _create_session_update_event method to understand how session parameters are constructed:

  6. MiniMax Assistant

    Let me check the related JS PR and the OpenAI Realtime Models documentation for the structure:

  7. MiniMax Assistant

    Let me check the RealtimeSessionCreateRequest class from the OpenAI SDK and what fields it has:

  8. MiniMax Assistant

    Let me look for the newer (v2) realtime API:

  9. MiniMax Assistant

    Now I have the complete picture. The RealtimeSessionCreateRequest has a reasoning field of type RealtimeReasoning. Let me look at what RealtimeReasoning is:

  10. MiniMax Assistant

    Let me check the models.py to see how _supports_reasoning_effort is implemented:

  11. MiniMax Assistant

    Now let me look at the related JS PR to understand exactly how it was implemented there:

  12. MiniMax Assistant

    Now let me look at the existing imports in realtime_model.py to understand which imports we already have:

  13. MiniMax Assistant

    Now I have all the info I need. Let me check what tests exist:

  14. MiniMax Assistant

    Now let me look at the JS PR to understand the exact naming convention. Let me check the git log:

  15. MiniMax Assistant

    Let me look at the complete Azure conversion:

  16. MiniMax Assistant

    Now I understand the structure. Let me check the __init__.py file:

  17. MiniMax Assistant

    Now let me also check the existing tests for the realtime model to see how tests are structured:

  18. MiniMax Assistant

    Now let me look at the full update_options method:

  19. MiniMax Assistant

    Now let me look at the update_options method on RealtimeSession (within the class):

  20. MiniMax Assistant

    Let me look at the Azure AzureSession to see if it supports reasoning:

  21. MiniMax Assistant

    Let me see how the existing _supports_reasoning_effort is being used to determine if the model needs default reasoning effort:

  22. MiniMax Assistant

    Now let me first write a small reproduction script to confirm that the feature doesn't currently work:

  23. MiniMax Assistant

    Let me see the conversion helpers in utils.py:

  24. MiniMax Assistant

    Now I have a clear understanding of the patterns. Let me make the changes to add reasoning support. First, let me update the imports:

  25. MiniMax Assistant

    Now let me make my changes step by step:

    Step 1: Update imports to add RealtimeReasoning and RealtimeReasoningEffort

  26. MiniMax Assistant

    Let me start making the changes to add the reasoning support. First, update the imports:

  27. MiniMax Assistant

    Now let me start with the actual changes. First, update the realtime_model.py file:

  28. MiniMax Assistant

    Now let me make the edits. First, I'll add the import for RealtimeReasoning:

  29. MiniMax Assistant

    Now let me make the edits.

    Step 1: Add imports

  30. MiniMax Assistant

    Step 2: Add the conversion helper in utils.py

  31. MiniMax Assistant

    Let me add the conversion helper and update the imports in utils.py:

  32. MiniMax Assistant

    Now add the to_realtime_reasoning helper function in utils.py:

  33. MiniMax Assistant

    Let me verify the inserted code:

  34. MiniMax Assistant

    Step 3: Update _RealtimeOptions to add reasoning field

  35. MiniMax Assistant

    Now let me add the reasoning field to _RealtimeOptions:

  36. MiniMax Assistant

    Step 4: Add reasoning parameter to all three __init__ overloads

  37. MiniMax Assistant

    Now I'll add reasoning parameter to all three __init__ overloads, plus the docstring. Let me carefully do this with one big edit:

  38. MiniMax Assistant

    Step 5: Pass reasoning to _RealtimeOptions in __init__

  39. MiniMax Assistant

    Now I need to import to_realtime_reasoning in realtime_model.py:

  40. MiniMax Assistant

    Step 6: Use reasoning in _create_session_update_event

  41. MiniMax Assistant

    Step 7: Update _oai_session_to_azure to skip reasoning (Azure doesn't support it)

    Let me check the AzureSession model:

  42. MiniMax Assistant

    Let me verify the Azure conversion function doesn't need updates:

  43. MiniMax Assistant

    Step 8: Add reasoning parameter to update_options on RealtimeModel

  44. MiniMax Assistant

    Step 9: Add reasoning to RealtimeSession.update_options

  45. MiniMax Assistant

    Now let me run my reproduction script to see if the changes work:

  46. MiniMax Assistant

    The basic case works. Now let me also test the other cases:

  47. MiniMax Assistant

    The first 5 tests pass. The 6th test failed because we can't run the session creation in a sync context. Let me modify the test to be more direct:

  48. MiniMax Assistant

    Now let me test the actual session update event is created correctly:

  49. MiniMax Assistant

    The reasoning field is correctly set in the session update event. Let me also test the update_options functionality:

  50. MiniMax Assistant

    Let me also test the Azure path:

  51. MiniMax Assistant

    Let me also verify the exact example from the issue:

  52. MiniMax Assistant

    All tests pass. Now let me also run any existing tests to make sure I haven't broken anything:

  53. MiniMax Assistant

    Let me run the existing tests to make sure my changes don't break anything (but with a sanity check on imports first):

  54. MiniMax Assistant

    Let me also check that the existing tests can be collected:

  55. MiniMax Assistant

    Tests collect correctly. Now let me check if any unit tests don't need API keys:

  56. MiniMax Assistant

    Now let me also look at how the project handles mypy / pyright / linting:

  57. MiniMax Assistant

    Let me run mypy on the openai plugin to see if my changes are type-safe:

  58. MiniMax Assistant

    Now let me also check the responses module to make sure my changes don't impact it:

  59. MiniMax Assistant

    These errors are not from my changes - they're from running mypy without the proper environment (it needs the SDK stubs). Let me look at how the official type-check script works:

  60. MiniMax Assistant

    Type checking passes. Now let me also test the update_options on the model:

  61. MiniMax Assistant

    Excellent! All my tests pass. Now let me also clean up the diff and make sure the changes are well organized. Let me look at the complete diff:

  62. MiniMax Assistant

    Now let me check if there are any other places where the realtime model is created or exposed that need to be updated:

  63. MiniMax Assistant

    Let me also check for any tests in the test directory that may exercise my code:

  64. MiniMax Assistant

    Let me also verify the livekit-plugins-openai pyproject.toml:

  65. MiniMax Assistant

    The OpenAI SDK version is openai[realtime]>=2 which should support RealtimeReasoning. Let me verify this is the case:

  66. MiniMax Assistant

    Now let me check if there's a similar reasoning feature in other realtime plugins (like xAI):

  67. MiniMax Assistant

    Let me verify the linter (ruff) doesn't complain:

  68. MiniMax Assistant

    Let me verify this is a pre-existing issue:

  69. MiniMax Assistant

    Hmm, the lint passes on the original. Let me see what's wrong:

  70. MiniMax Assistant

    The import order was fixed by the ruff fix. Let me also check the utils.py:

  71. MiniMax Assistant

    Let me check the new realtime_model.py file at the imports to see if the import was sorted by ruff:

  72. MiniMax Assistant

    Now let me also run lint on the entire openai plugin:

  73. MiniMax Assistant

    Let me also verify mypy:

  74. MiniMax Assistant

    Now let me also run my reproduction test again to confirm everything still works:

  75. MiniMax Assistant

    All my tests pass. Let me also test edge cases:

  76. MiniMax Assistant

    All edge cases pass. Now let me also verify the Azure path more thoroughly:

  77. MiniMax Assistant

    Now let me also test that the issue example works exactly as the user requested:

  78. MiniMax Assistant

    The exact example from the issue now works. Let me also do a quick sanity check on the __init__.py to make sure everything is exported correctly:

  79. MiniMax Assistant

    Let me clean up the temporary test files:

  80. MiniMax Assistant

    Let me also check that the final diff looks clean:

  81. MiniMax Assistant

    Let me make a final comprehensive test to confirm everything is working:

  82. MiniMax Assistant

    All tests pass! Let me also clean up the test file and verify final state:

  83. MiniMax Assistant

    Let me also verify the final state of the files:

  84. MiniMax Assistant

    Now let me run the mypy and ruff checks one more time to confirm everything is clean:

  85. MiniMax Assistant

    Let me also check that the tests in tests/test_realtime/test_realtime.py don't break by trying to collect them:

  86. MiniMax Assistant

    Tests collect successfully. Let me also run the test_config.py to make sure those basic tests still pass:

  87. MiniMax Assistant

    Now let me also check the responses LLM to see if I missed anything:

  88. MiniMax Assistant

    All changes are in the right place. Let me also verify that everything compiles in the __init__.py:

  89. MiniMax Assistant

    Let me do one final check to verify all my changes are complete and working:

  90. MiniMax Assistant

    Now let me go through the checklist to verify everything is done:

    1. If an error was reported in the issue description, I have successfully reproduced it. ✓ The issue was that reasoning was not supported in RealtimeModel.__init__. I reproduced this with a test script that called RealtimeModel(model="gpt-realtime-2", reasoning={"effort": "low"}) and got an AttributeError.

    2. If an error was reported in the issue description, I have confirmed that my fix resolves the error. ✓ After my changes, the exact example from the issue works: llm = openai.realtime.RealtimeModel(model="gpt-realtime-2", reasoning={"effort": "low"}) creates a model with llm._opts.reasoning properly set to RealtimeReasoning(effort="low").

    3. I have thought about edge cases and made sure my fix handles them as well. ✓ Tested with:

      • dict form {"effort": "low"} - works
      • RealtimeReasoning instance form - works
      • All valid effort values (minimal, low, medium, high, xhigh) - work
      • None and no reasoning (default) - work
      • Invalid effort value - raises ValidationError
      • Azure path - reasoning is silently dropped (since Azure doesn't support it)
      • update_options on both RealtimeModel and RealtimeSession - work
      • Session update event contains the reasoning field - works
    4. I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. ✓ tests/test_config.py passes ✓ tests/test_realtime/test_realtime.py - 49 tests collect successfully (couldn't run because they need API keys) ✓ mypy passes with "no issues found in 15 source files" ✓ ruff passes with "All checks passed!"

    Let me also verify the final state of the diff one more time:

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.