Skip to content

Commit 12b63aa

Browse files
sirozhaclaude
andcommitted
fix(llms): remove stale xhigh/max clamp in GetEffort
GetEffort was silently downgrading ReasoningXHigh/ReasoningMax to ReasoningHigh on the non-adaptive (effort/budget) path. Now that OpenAI-compatible providers such as GPT-5.5 and GLM-5.2 accept reasoning_effort=xhigh/max natively, the clamp is incorrect and prevents those levels from reaching the API. Update the GetEffort table tests to assert pass-through (they still asserted the removed clamp), and drop the now-false "adaptive-only" wording from the GetTokens budget comment. GetTokens itself still maps xhigh/max to the high token budget — there is no distinct budget tier. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c85de76 commit 12b63aa

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

llms/options.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ const (
3434
ReasoningMedium ReasoningEffort = "medium"
3535
ReasoningLow ReasoningEffort = "low"
3636
ReasoningNone ReasoningEffort = ""
37-
// ReasoningXHigh and ReasoningMax are adaptive-thinking efforts (Claude Opus 4.7+);
38-
// pass them via WithAdaptiveReasoning. On the budget-token path they clamp to high
39-
// (no provider has a distinct budget for them).
37+
// ReasoningXHigh and ReasoningMax are the top reasoning efforts. Anthropic adaptive
38+
// thinking (Claude Opus 4.7+) carries them via WithAdaptiveReasoning; OpenAI-compatible
39+
// providers that expose them (e.g. GPT-5.5, GLM-5.2) accept them as reasoning_effort.
4040
ReasoningXHigh ReasoningEffort = "xhigh"
4141
ReasoningMax ReasoningEffort = "max"
4242
)
@@ -83,12 +83,6 @@ func (r *ReasoningConfig) GetEffort(maxTokens int) ReasoningEffort {
8383
}
8484

8585
if r.Effort != ReasoningNone {
86-
// xhigh/max are adaptive-only; on the budget/effort path clamp them to high
87-
// so callers never emit an effort the budget API rejects.
88-
if r.Effort == ReasoningXHigh || r.Effort == ReasoningMax {
89-
return ReasoningHigh
90-
}
91-
9286
return r.Effort
9387
}
9488

@@ -139,7 +133,7 @@ func (r *ReasoningConfig) GetTokens(maxTokens int) int {
139133
case ReasoningMedium:
140134
tokens = max(maxTokens/3, 2048)
141135
case ReasoningHigh, ReasoningXHigh, ReasoningMax:
142-
// xhigh/max are adaptive-only; on the budget path treat them as high.
136+
// no distinct token budget for xhigh/max; map them to the high budget.
143137
tokens = max(maxTokens/2, 4096)
144138
case ReasoningNone:
145139
return 0 // disabled

llms/options_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,16 +597,16 @@ func TestReasoningConfig_GetEffort(t *testing.T) {
597597
expected: llms.ReasoningHigh,
598598
},
599599
{
600-
name: "xhigh effort clamps to high (adaptive-only on the effort path)",
600+
name: "xhigh effort passes through on the effort path",
601601
config: &llms.ReasoningConfig{Effort: llms.ReasoningXHigh},
602602
maxTokens: maxTokens,
603-
expected: llms.ReasoningHigh,
603+
expected: llms.ReasoningXHigh,
604604
},
605605
{
606-
name: "max effort clamps to high (adaptive-only on the effort path)",
606+
name: "max effort passes through on the effort path",
607607
config: &llms.ReasoningConfig{Effort: llms.ReasoningMax},
608608
maxTokens: maxTokens,
609-
expected: llms.ReasoningHigh,
609+
expected: llms.ReasoningMax,
610610
},
611611
{
612612
name: "config with low tokens",

0 commit comments

Comments
 (0)