Skip to content

fix(openai): Set Auto Reasoning effort to Medium#8211

Merged
justin-tahara merged 2 commits intomainfrom
jtahara/chat-5.2-fix
Feb 6, 2026
Merged

fix(openai): Set Auto Reasoning effort to Medium#8211
justin-tahara merged 2 commits intomainfrom
jtahara/chat-5.2-fix

Conversation

@justin-tahara
Copy link
Copy Markdown
Contributor

@justin-tahara justin-tahara commented Feb 6, 2026

Description

There is an issue where Chat GPT 5.2 will not accept low as a valid level of reasoning so working on cleaning this up to ensure that we are properly setting the correct reasoning level for the model.

How Has This Been Tested?

Ran locally and tested against 4 series for regular, mini and pro
Ran locally and tested against 5 series for regular, mini and pro

Additional Options

  • [Required] I have considered whether this PR needs to be cherry-picked to the latest beta branch.
  • [Optional] Override Linear Check

Summary by cubic

Sets the default reasoning level for OpenAI GPT-5.2 chat models to “medium” when “auto” is requested, and uses “medium” as the fallback. This prevents API errors and keeps requests compatible with 5.2 reasoning models.

  • Bug Fixes
    • Map ReasoningEffort.AUTO to "medium" (was "low").
    • Default to "medium" when an invalid/unsupported reasoning value is given for OpenAI reasoning models.
    • Add unit test to verify "auto" -> "medium" for gpt-5.2.

Written for commit 9148bce. Summary will update on new commits.

@justin-tahara justin-tahara requested a review from a team as a code owner February 6, 2026 00:31
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 6, 2026

Greptile Overview

Greptile Summary

This PR fixes an issue where GPT-5.2 chat models reject "low" as a valid reasoning effort level. The fix changes the default AUTO reasoning effort from "low" to "medium" across both the OpenAI reasoning effort mapping and the fallback case for non-standard reasoning models.

Changes:

  • Updated OPENAI_REASONING_EFFORT[ReasoningEffort.AUTO] from "low" to "medium" in models.py:33
  • Updated fallback reasoning_effort from ReasoningEffort.LOW.value to ReasoningEffort.MEDIUM.value in multi_llm.py:351
  • Added test test_openai_chat_auto_reasoning_effort_maps_to_medium() to verify the fix works for GPT-5.2 chat models

The changes are consistent, well-tested, and align with the PR description which states the issue was tested against both 4-series and 5-series models.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Changes are straightforward constant updates with appropriate test coverage. The fix addresses a specific API compatibility issue with GPT-5.2 models and has been manually tested against multiple model series
  • No files require special attention

Important Files Changed

Filename Overview
backend/onyx/llm/models.py Changed default AUTO reasoning effort from 'low' to 'medium' for OpenAI models
backend/onyx/llm/multi_llm.py Updated fallback reasoning_effort from LOW to MEDIUM for non-OpenAI reasoning models
backend/tests/unit/onyx/llm/test_multi_llm.py Added test to verify AUTO reasoning effort maps to 'medium' for GPT-5.2 chat models

Sequence Diagram

sequenceDiagram
    participant Client
    participant LitellmLLM
    participant ReasoningEffort
    participant OpenAI API

    Client->>LitellmLLM: stream(messages, reasoning_effort=AUTO)
    LitellmLLM->>LitellmLLM: Check if reasoning model
    alt GPT-5 chat model (contains "-chat")
        LitellmLLM->>ReasoningEffort: Map AUTO → "medium"
        LitellmLLM->>LitellmLLM: Skip reasoning params (OpenAI bug)
        LitellmLLM->>LitellmLLM: Set reasoning_effort="medium"
    else GPT-5 non-chat reasoning model
        LitellmLLM->>ReasoningEffort: Map AUTO → "medium"
        LitellmLLM->>LitellmLLM: Set reasoning.effort="medium"
    else Other reasoning models
        LitellmLLM->>LitellmLLM: Use fallback MEDIUM
        LitellmLLM->>LitellmLLM: Set reasoning_effort="medium"
    end
    LitellmLLM->>OpenAI API: completion(reasoning_effort="medium")
    OpenAI API-->>LitellmLLM: Response stream
    LitellmLLM-->>Client: Model responses
Loading

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

@justin-tahara justin-tahara changed the title fix(openai): Fixing Reasoning fix(openai): Set Auto Reasoning effort to Medium Feb 6, 2026
@justin-tahara justin-tahara added this pull request to the merge queue Feb 6, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 6, 2026
@justin-tahara justin-tahara added this pull request to the merge queue Feb 6, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 6, 2026
@justin-tahara justin-tahara added this pull request to the merge queue Feb 6, 2026
Merged via the queue into main with commit a342c4d Feb 6, 2026
79 checks passed
@justin-tahara justin-tahara deleted the jtahara/chat-5.2-fix branch February 6, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants