fix(anthropic): support anthropic-sdk-go v1.46.0

This commit is contained in:
afjcjsbx
2026-05-31 11:54:35 +02:00
parent 4b8761ce6d
commit 6e0e2906aa
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -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,
+1 -1
View File
@@ -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 {