Skip to content

Commit 41c6a56

Browse files
Backport: fix(anthropic): skip passing beta header for tool search tools (#13500)
This is an automated backport of #13496 to the release-v6.0 branch. FYI @aayush-kapoor Co-authored-by: Aayush Kapoor <83492835+aayush-kapoor@users.noreply.github.com>
1 parent 1513cee commit 41c6a56

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

.changeset/odd-oranges-sparkle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@ai-sdk/anthropic': patch
3+
---
4+
5+
fix(anthropic): skip passing beta header for tool search tools

packages/anthropic/src/anthropic-messages-language-model.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,7 @@ describe('AnthropicMessagesLanguageModel', () => {
31123112
it('should include advanced-tool-use beta header', async () => {
31133113
expect(server.calls[0].requestHeaders).toMatchInlineSnapshot(`
31143114
{
3115-
"anthropic-beta": "advanced-tool-use-2025-11-20,structured-outputs-2025-11-13",
3115+
"anthropic-beta": "structured-outputs-2025-11-13",
31163116
"anthropic-version": "2023-06-01",
31173117
"content-type": "application/json",
31183118
"x-api-key": "test-api-key",
@@ -3218,7 +3218,7 @@ describe('AnthropicMessagesLanguageModel', () => {
32183218
it('should include advanced-tool-use beta header', async () => {
32193219
expect(server.calls[0].requestHeaders).toMatchInlineSnapshot(`
32203220
{
3221-
"anthropic-beta": "advanced-tool-use-2025-11-20,structured-outputs-2025-11-13",
3221+
"anthropic-beta": "structured-outputs-2025-11-13",
32223222
"anthropic-version": "2023-06-01",
32233223
"content-type": "application/json",
32243224
"x-api-key": "test-api-key",

packages/anthropic/src/anthropic-prepare-tools.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,7 @@ describe('prepareTools', () => {
861861

862862
expect(result).toMatchInlineSnapshot(`
863863
{
864-
"betas": Set {
865-
"advanced-tool-use-2025-11-20",
866-
},
864+
"betas": Set {},
867865
"toolChoice": undefined,
868866
"toolWarnings": [],
869867
"tools": [
@@ -923,9 +921,7 @@ describe('prepareTools', () => {
923921

924922
expect(result).toMatchInlineSnapshot(`
925923
{
926-
"betas": Set {
927-
"advanced-tool-use-2025-11-20",
928-
},
924+
"betas": Set {},
929925
"toolChoice": undefined,
930926
"toolWarnings": [],
931927
"tools": [

packages/anthropic/src/anthropic-prepare-tools.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ export async function prepareTools({
322322
}
323323

324324
case 'anthropic.tool_search_regex_20251119': {
325-
betas.add('advanced-tool-use-2025-11-20');
326325
anthropicTools.push({
327326
type: 'tool_search_tool_regex_20251119',
328327
name: 'tool_search_tool_regex',
@@ -331,7 +330,6 @@ export async function prepareTools({
331330
}
332331

333332
case 'anthropic.tool_search_bm25_20251119': {
334-
betas.add('advanced-tool-use-2025-11-20');
335333
anthropicTools.push({
336334
type: 'tool_search_tool_bm25_20251119',
337335
name: 'tool_search_tool_bm25',

0 commit comments

Comments
 (0)