Skip to content

[Claimed #1844] Refactor model ID checks for GPT 5.x model family#1852

Open
github-actions[bot] wants to merge 3 commits intomainfrom
external-contributor-pr-1844
Open

[Claimed #1844] Refactor model ID checks for GPT 5.x model family#1852
github-actions[bot] wants to merge 3 commits intomainfrom
external-contributor-pr-1844

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Mar 18, 2026

Mirrored from external contributor PR #1844 after approval by @miguelg719.

Original author: @praveentcom
Original PR: #1844
Approved source head SHA: a637dc329bfc5426bb71c8551c812191ed631527

@praveentcom, please continue any follow-up discussion on this mirrored PR. When the external PR gets new commits, this same internal PR will be marked stale until the latest external commit is approved and refreshed here.

Original description

All GPT-5.x series models don't support minimal as the reasoningEffort. Currently, it is enabled only for GPT-5.1 and GPT-5.2 models to set the reasoningEffort as low. This would start throwing errors like these.

Unsupported value: 'minimal' is not supported with the 'gpt-5.4' model. Supported values are: 'none', 'low', 'medium', 'high', and 'xhigh'.

This PR fixes the behavior to set the reasoning effort as low for all GPT-5.x series models so that we don't need to manually patch it every time when a new SOTA model is released.


Summary by cubic

Set reasoningEffort to "low" for all GPT-5.x models by matching gpt-5. and excluding codex, preventing unsupported "minimal" errors on new releases like gpt-5.4. This removes the need for version-specific patches.

Written for commit 55b44dc. Summary will update on new commits. Review in cubic

@github-actions github-actions bot added external-contributor Tracks PRs mirrored from external contributor forks. external-contributor:mirrored An internal mirrored PR currently exists for this external contributor PR. labels Mar 18, 2026
@github-actions
Copy link
Contributor Author

This mirrored PR tracks external contributor PR #1844 at source SHA a637dc329bfc5426bb71c8551c812191ed631527, approved by @miguelg719.
Original PR: #1844

When the external PR gets new commits, this same internal PR will be refreshed in place after the latest external commit is approved.

@changeset-bot
Copy link

changeset-bot bot commented Mar 18, 2026

⚠️ No Changeset found

Latest commit: 55b44dc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
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 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 18, 2026

Greptile Summary

This PR generalises the reasoningEffort guard in AISdkClient so that all gpt-5.x models automatically receive "low" reasoning effort instead of the unsupported "minimal" value, removing the need to manually patch in each new GPT-5 minor version.

  • What changed: The usesLowReasoningEffort condition was broadened from explicitly listing gpt-5.1 and gpt-5.2 to a single gpt-5. substring match (trailing dot avoids false-positives from gpt-50, etc.), while keeping the !isCodex exclusion in place.
  • Impact: Any currently-deployed or future gpt-5.x model will now correctly receive reasoningEffort: "low" when used via generateObject, preventing the "minimal" is not supported API error.
  • Edge case: A bare gpt-5 alias (no version decimal) would still hit isGPT5 = true but usesLowReasoningEffort = false, so it would fall back to "minimal" — the same error this PR aims to prevent. This is a minor concern worth considering.
  • Pre-existing gap (not introduced here): The providerOptions block applying reasoningEffort is only present in the generateObject path; the generateText path at line 309 does not apply it.

Confidence Score: 4/5

  • Safe to merge — the change correctly resolves the "minimal" reasoning effort error for GPT-5.x models with one minor edge case for potential bare gpt-5 aliases.
  • The one-line logic change is well-targeted and correct for all versioned gpt-5.x models. The only open question is whether a bare gpt-5 alias (no decimal) could ever be used, which would still regress to the old bug.
  • packages/core/lib/v3/llm/aisdk.ts — specifically lines 137–139 for the edge case around a bare gpt-5 model alias.

Important Files Changed

Filename Overview
packages/core/lib/v3/llm/aisdk.ts Replaces version-specific gpt-5.1/gpt-5.2 checks with a gpt-5. prefix match to apply "low" reasoning effort across all GPT-5.x models; minor edge case remains where a bare gpt-5 alias (no decimal) would still fall through to "minimal".

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[modelId] --> B{includes 'gpt-5'?}
    B -- No --> C[isGPT5 = false\nproviderOptions = undefined]
    B -- Yes --> D{includes 'codex'?}
    D -- Yes --> E[isCodex = true\nreasoningEffort = 'medium'\ntextVerbosity = 'medium']
    D -- No --> F{includes 'gpt-5.' with dot?}
    F -- Yes --> G["usesLowReasoningEffort = true\nreasoningEffort = 'low'\ntextVerbosity = 'low'"]
    F -- No --> H["usesLowReasoningEffort = false\nreasoningEffort = 'minimal' ⚠️\ntextVerbosity = 'low'"]
    H --> I["e.g. bare 'gpt-5' alias\n— still hits unsupported value"]
Loading

Last reviewed commit: "formatting"

Comment on lines 137 to 139
const usesLowReasoningEffort =
(this.model.modelId.includes("gpt-5.1") ||
this.model.modelId.includes("gpt-5.2")) &&
!isCodex;
this.model.modelId.includes("gpt-5.") && !isCodex;
// Kimi models only support temperature=1
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Unversioned gpt-5 alias falls through to "minimal"

The "gpt-5." substring check (with trailing dot) correctly captures all gpt-5.x versioned models (e.g. gpt-5.1, gpt-5.4). However, if OpenAI publishes an unversioned gpt-5 alias (without a decimal, similar to how gpt-4 exists alongside gpt-4.x), it would match isGPT5 but not usesLowReasoningEffort, causing it to fall through to "minimal" reasoning effort — the exact error this PR is trying to prevent.

Since the PR description states "All GPT-5.x series models don't support minimal", consider widening the guard to also cover a bare gpt-5 model:

Suggested change
const usesLowReasoningEffort =
(this.model.modelId.includes("gpt-5.1") ||
this.model.modelId.includes("gpt-5.2")) &&
!isCodex;
this.model.modelId.includes("gpt-5.") && !isCodex;
// Kimi models only support temperature=1
const usesLowReasoningEffort =
(this.model.modelId.includes("gpt-5.") ||
this.model.modelId === "gpt-5") &&
!isCodex;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor:mirrored An internal mirrored PR currently exists for this external contributor PR. external-contributor Tracks PRs mirrored from external contributor forks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants