test: cover OpenAI GPT xhigh reasoning · openclaw/openclaw@d4d307e
steipete
·
2026-04-24
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -13,7 +13,7 @@ title: "Thinking levels"
|
13 | 13 | - low → “think hard” |
14 | 14 | - medium → “think harder” |
15 | 15 | - high → “ultrathink” (max budget) |
16 | | -- xhigh → “ultrathink+” (GPT-5.2 + Codex models and Anthropic Claude Opus 4.7 effort) |
| 16 | +- xhigh → “ultrathink+” (GPT-5.2+ and Codex models, plus Anthropic Claude Opus 4.7 effort) |
17 | 17 | - adaptive → provider-managed adaptive thinking (supported for Claude 4.6 on Anthropic/Bedrock and Anthropic Claude Opus 4.7) |
18 | 18 | - max → provider max reasoning (currently Anthropic Claude Opus 4.7) |
19 | 19 | - `x-high`, `x_high`, `extra-high`, `extra high`, and `extra_high` map to `xhigh`. |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import { describe, expect, it } from "vitest"; |
| 2 | +import { |
| 3 | +resolveOpenAIReasoningEffortForModel, |
| 4 | +resolveOpenAISupportedReasoningEfforts, |
| 5 | +} from "./openai-reasoning-effort.js"; |
| 6 | + |
| 7 | +describe("OpenAI reasoning effort support", () => { |
| 8 | +it.each([ |
| 9 | +{ provider: "openai", id: "gpt-5.5" }, |
| 10 | +{ provider: "openai-codex", id: "gpt-5.5" }, |
| 11 | +])("preserves xhigh for $provider/$id", (model) => { |
| 12 | +expect(resolveOpenAISupportedReasoningEfforts(model)).toContain("xhigh"); |
| 13 | +expect(resolveOpenAIReasoningEffortForModel({ model, effort: "xhigh" })).toBe("xhigh"); |
| 14 | +}); |
| 15 | + |
| 16 | +it("does not downgrade xhigh when Pi compat metadata declares it explicitly", () => { |
| 17 | +const model = { |
| 18 | +provider: "openai-codex", |
| 19 | +id: "gpt-5.5", |
| 20 | +compat: { |
| 21 | +supportedReasoningEfforts: ["low", "medium", "high", "xhigh"], |
| 22 | +}, |
| 23 | +}; |
| 24 | + |
| 25 | +expect(resolveOpenAIReasoningEffortForModel({ model, effort: "xhigh" })).toBe("xhigh"); |
| 26 | +}); |
| 27 | +}); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -158,4 +158,25 @@ describe("createOpenAIThinkingLevelWrapper", () => {
|
158 | 158 | expect(payloads[0]?.reasoning).toEqual({ effort: level }); |
159 | 159 | } |
160 | 160 | }); |
| 161 | + |
| 162 | +it.each([ |
| 163 | +{ |
| 164 | +api: "openai-responses", |
| 165 | +provider: "openai", |
| 166 | +id: "gpt-5.5", |
| 167 | +}, |
| 168 | +{ |
| 169 | +api: "openai-codex-responses", |
| 170 | +provider: "openai-codex", |
| 171 | +id: "gpt-5.5", |
| 172 | +}, |
| 173 | +] as const)("preserves xhigh for $provider/$id", (model) => { |
| 174 | +const { baseStreamFn, payloads } = createPayloadCapture({ |
| 175 | +initialReasoning: { effort: "high" }, |
| 176 | +}); |
| 177 | +const wrapped = createOpenAIThinkingLevelWrapper(baseStreamFn, "xhigh"); |
| 178 | +void wrapped(model as Model<typeof model.api>, { messages: [] }, {}); |
| 179 | + |
| 180 | +expect(payloads[0]?.reasoning).toEqual({ effort: "xhigh" }); |
| 181 | +}); |
161 | 182 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。