Skip to content

Commit 0c5783b

Browse files
committed
fix(providers/anthropic): enable mythos adaptive display
1 parent d9e580e commit 0c5783b

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎providers/anthropic/anthropic.go‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,18 @@ func thinkingDisplay(providerOptions *ProviderOptions, modelID string) (Thinking
4949
return "", false
5050
}
5151

52+
func defaultsToAdaptiveThinking(model string) bool {
53+
model = strings.ToLower(strings.TrimSpace(model))
54+
return strings.Contains(model, "claude-mythos-preview")
55+
}
56+
5257
func setThinkingDisplay(param interface{ SetExtraFields(map[string]any) }, display ThinkingDisplay) {
5358
param.SetExtraFields(map[string]any{"display": string(display)})
5459
}
5560

5661
func defaultsToOmittedThinkingDisplay(model string) bool {
5762
model = strings.ToLower(strings.TrimSpace(model))
58-
if strings.Contains(model, "claude-mythos-preview") {
63+
if defaultsToAdaptiveThinking(model) {
5964
return true
6065
}
6166
_, suffix, ok := strings.Cut(model, "claude-opus-4-")
@@ -414,6 +419,12 @@ func (a languageModel) prepareParams(call fantasy.Call) (
414419
Details: "TopK is not supported when thinking is enabled",
415420
})
416421
}
422+
case defaultsToAdaptiveThinking(a.modelID):
423+
adaptive := anthropic.NewThinkingConfigAdaptiveParam()
424+
if display, ok := thinkingDisplay(providerOptions, a.modelID); ok {
425+
setThinkingDisplay(&adaptive, display)
426+
}
427+
params.Thinking.OfAdaptive = &adaptive
417428
}
418429

419430
if len(call.Tools) > 0 {

‎providers/anthropic/anthropic_test.go‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,15 @@ func TestGenerate_SendsThinkingDisplay(t *testing.T) {
725725
wantType: "adaptive",
726726
wantDisplay: "omitted",
727727
},
728+
{
729+
name: "mythos models default to adaptive thinking",
730+
model: "claude-mythos-preview",
731+
options: func() *ProviderOptions {
732+
return &ProviderOptions{}
733+
},
734+
wantType: "adaptive",
735+
wantDisplay: "summarized",
736+
},
728737
{
729738
name: "older opus models keep provider default",
730739
model: "claude-opus-4-6-20260101",

0 commit comments

Comments
 (0)