Add max and ultra reasoning efforts to the SDKs (#39662)

## What changed

- Add `max` and `ultra` to the TypeScript `ModelReasoningEffort` type.
- Add matching Python `ReasoningEffort` members and preserve them when SDK artifacts are regenerated.
- Update the Python model-selection examples to rank the new effort levels.

## Testing

- Cover serialization of both new Python enum members while continuing to accept unknown future values.

GitOrigin-RevId: 1412b77bdbb2530f5d38921cdea971dd34458353
This commit is contained in:
ianw-oai
2026-08-20 04:59:20 +00:00
committed by copyberry
parent 631d5a8b02
commit 240bbfc14a
6 changed files with 29 additions and 6 deletions

View File

@@ -28,6 +28,8 @@ REASONING_RANK = {
"medium": 3,
"high": 4,
"xhigh": 5,
"max": 6,
"ultra": 7,
}

View File

@@ -26,6 +26,8 @@ REASONING_RANK = {
"medium": 3,
"high": 4,
"xhigh": 5,
"max": 6,
"ultra": 7,
}

View File

@@ -656,6 +656,8 @@ def _preserve_reasoning_effort_enum(out_path: Path) -> None:
medium = "medium"
high = "high"
xhigh = "xhigh"
max = "max"
ultra = "ultra"
@classmethod
def _missing_(cls, value: object) -> ReasoningEffort | None:

View File

@@ -3208,6 +3208,8 @@ class ReasoningEffort(str, Enum):
medium = "medium"
high = "high"
xhigh = "xhigh"
max = "max"
ultra = "ultra"
@classmethod
def _missing_(cls, value: object) -> ReasoningEffort | None:

View File

@@ -2,6 +2,8 @@ from __future__ import annotations
from pathlib import Path
import pytest
from openai_codex.client import CodexClient, _params_dict
from openai_codex.generated.notification_registry import notification_turn_id
from openai_codex.generated.v2_all import (
@@ -73,18 +75,24 @@ def test_plan_type_accepts_business_prolite_from_newer_runtime() -> None:
assert rate_limits_updated.payload.rate_limits.plan_type == PlanType(plan_type)
def test_reasoning_effort_preserves_enum_constants_and_accepts_future_values() -> None:
@pytest.mark.parametrize(
("effort", "wire_value"),
[(ReasoningEffort.max, "max"), (ReasoningEffort.ultra, "ultra")],
)
def test_reasoning_effort_preserves_enum_constants_and_accepts_future_values(
effort: ReasoningEffort, wire_value: str
) -> None:
"""Known effort members and new runtime values should share the enum-style API."""
known_option = ReasoningEffortOption.model_validate(
{"description": "Balanced", "reasoningEffort": "medium"}
)
future_option = ReasoningEffortOption.model_validate(
{"description": "Future", "reasoningEffort": "ultra"}
{"description": "Future", "reasoningEffort": "future"}
)
turn_params = TurnStartParams(
thread_id="thread-1",
input=[],
effort=ReasoningEffort.medium,
effort=effort,
)
assert {
@@ -95,8 +103,8 @@ def test_reasoning_effort_preserves_enum_constants_and_accepts_future_values() -
} == {
"known_member": "medium",
"known_option": "medium",
"future_option": "ultra",
"turn_effort": "medium",
"future_option": "future",
"turn_effort": wire_value,
}

View File

@@ -2,7 +2,14 @@ export type ApprovalMode = "never" | "on-request" | "on-failure" | "untrusted";
export type SandboxMode = "read-only" | "workspace-write" | "danger-full-access";
export type ModelReasoningEffort = "minimal" | "low" | "medium" | "high" | "xhigh";
export type ModelReasoningEffort =
| "minimal"
| "low"
| "medium"
| "high"
| "xhigh"
| "max"
| "ultra";
export type WebSearchMode = "disabled" | "cached" | "live";