From 6e0e2906aa7deb148948fbb792d9e78508216494 Mon Sep 17 00:00:00 2001 From: afjcjsbx Date: Sun, 31 May 2026 11:54:35 +0200 Subject: [PATCH] fix(anthropic): support anthropic-sdk-go v1.46.0 --- pkg/providers/anthropic/provider.go | 6 ++++-- pkg/providers/anthropic/provider_test.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/providers/anthropic/provider.go b/pkg/providers/anthropic/provider.go index 6f4aadb8b..9685fe598 100644 --- a/pkg/providers/anthropic/provider.go +++ b/pkg/providers/anthropic/provider.go @@ -219,7 +219,7 @@ func buildParams( apiModel := strings.ReplaceAll(model, ".", "-") params := anthropic.MessageNewParams{ - Model: anthropic.Model(apiModel), + Model: apiModel, Messages: anthropicMessages, MaxTokens: maxTokens, } @@ -262,7 +262,9 @@ func applyThinkingConfig(params *anthropic.MessageNewParams, level string) { params.Temperature = anthropic.MessageNewParams{}.Temperature if level == "adaptive" { - adaptive := anthropic.NewThinkingConfigAdaptiveParam() + adaptive := anthropic.ThinkingConfigAdaptiveParam{ + Display: anthropic.ThinkingConfigAdaptiveDisplaySummarized, + } params.Thinking = anthropic.ThinkingConfigParamUnion{OfAdaptive: &adaptive} params.OutputConfig = anthropic.OutputConfigParam{ Effort: anthropic.OutputConfigEffortHigh, diff --git a/pkg/providers/anthropic/provider_test.go b/pkg/providers/anthropic/provider_test.go index b1aed17b5..b53d3d76c 100644 --- a/pkg/providers/anthropic/provider_test.go +++ b/pkg/providers/anthropic/provider_test.go @@ -21,7 +21,7 @@ func TestBuildParams_BasicMessage(t *testing.T) { if err != nil { t.Fatalf("buildParams() error: %v", err) } - if string(params.Model) != "claude-sonnet-4-6" { + if params.Model != "claude-sonnet-4-6" { t.Errorf("Model = %q, want %q", params.Model, "claude-sonnet-4-6") } if params.MaxTokens != 1024 {