[DSV4] Support max reasoning effort (#40982)

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
This commit is contained in:
Bugen Zhao
2026-04-29 11:03:47 +00:00
committed by GitHub
parent 37e288214b
commit 33f36d4260
6 changed files with 126 additions and 6 deletions
@@ -3,7 +3,6 @@
import datetime
from collections.abc import Iterable, Sequence
from typing import Literal
from openai.types.responses.tool import Tool
from openai_harmony import (
@@ -66,7 +65,7 @@ def get_encoding():
def get_system_message(
model_identity: str | None = None,
reasoning_effort: Literal["high", "medium", "low"] | None = None,
reasoning_effort: str | None = None,
start_date: str | None = None,
browser_description: str | None = None,
python_description: str | None = None,
@@ -84,6 +83,12 @@ def get_system_message(
)
sys_msg_content = sys_msg_content.with_model_identity(new_identity)
if reasoning_effort is not None:
if reasoning_effort not in REASONING_EFFORT:
supported_values = ", ".join(REASONING_EFFORT)
raise ValueError(
f"reasoning_effort={reasoning_effort!r} is not supported by "
f"Harmony. Supported values are: {supported_values}."
)
sys_msg_content = sys_msg_content.with_reasoning_effort(
REASONING_EFFORT[reasoning_effort]
)