mirror of
https://github.com/openai/codex.git
synced 2026-08-23 13:09:46 +00:00
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:
@@ -28,6 +28,8 @@ REASONING_RANK = {
|
||||
"medium": 3,
|
||||
"high": 4,
|
||||
"xhigh": 5,
|
||||
"max": 6,
|
||||
"ultra": 7,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ REASONING_RANK = {
|
||||
"medium": 3,
|
||||
"high": 4,
|
||||
"xhigh": 5,
|
||||
"max": 6,
|
||||
"ultra": 7,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user