From 44c80c36cf6cd15ca4c0402983b73df68dde203d Mon Sep 17 00:00:00 2001 From: Rodin Date: Sat, 9 May 2026 23:48:21 -0700 Subject: [PATCH] fix: use bedrock-2023-05-31 for AI Core Anthropic version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SAP AI Core's Anthropic endpoint uses AWS Bedrock API format, not native Anthropic API. Verified via integration testing: - 2023-06-01: Invalid API version - bedrock-2023-05-31: Works ✓ --- llm/aicore.go | 2 +- llm/aicore_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/llm/aicore.go b/llm/aicore.go index 3722d50..ed58d43 100644 --- a/llm/aicore.go +++ b/llm/aicore.go @@ -253,7 +253,7 @@ func (c *AICoreClient) CompleteAnthropic(ctx context.Context, model string, mess } reqBody := anthropicRequest{ - // AnthropicVersion omitted - SAP AI Core does not accept it in body + AnthropicVersion: "bedrock-2023-05-31", // SAP AI Core uses Bedrock format // Model omitted - AI Core deployment already specifies model MaxTokens: maxTokens, System: system, diff --git a/llm/aicore_test.go b/llm/aicore_test.go index 7f11da3..a59026f 100644 --- a/llm/aicore_test.go +++ b/llm/aicore_test.go @@ -206,8 +206,8 @@ func TestAICoreClient_CompleteAnthropic(t *testing.T) { if err := json.NewDecoder(r.Body).Decode(&req); err != nil { t.Fatalf("decode request: %v", err) } - if req.MaxTokens == 0 { - t.Errorf("expected max_tokens in request") + if req.AnthropicVersion != "bedrock-2023-05-31" { + t.Errorf("expected bedrock anthropic_version in request") } if req.System != "You are helpful" { t.Errorf("expected system prompt: %q", req.System)