@ai-sdk/anthropic 4.0.24 → 4.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +47 -8
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +4 -4
- package/dist/internal/index.js +46 -7
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +5 -0
- package/package.json +3 -3
- package/src/anthropic-language-model.ts +4 -1
- package/src/sanitize-json-schema.ts +2 -5
- package/src/tool/code-execution_20250825.ts +26 -1
- package/src/tool/code-execution_20260120.ts +26 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 4.0.26
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dc0c28e: Return visible summarized reasoning when generic reasoning enables adaptive thinking.
|
|
8
|
+
- Updated dependencies [fa95504]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.17
|
|
10
|
+
|
|
11
|
+
## 4.0.25
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- d8210b6: chore: centralize record type guards in provider-utils
|
|
16
|
+
- b192878: feat: add experimental_toolCaller routing to generateText for code mode
|
|
17
|
+
- Updated dependencies [d8210b6]
|
|
18
|
+
- Updated dependencies [b192878]
|
|
19
|
+
- @ai-sdk/provider-utils@5.0.16
|
|
20
|
+
|
|
3
21
|
## 4.0.24
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -553,7 +553,7 @@ declare const anthropicTools: {
|
|
|
553
553
|
new_start: number | null;
|
|
554
554
|
old_lines: number | null;
|
|
555
555
|
old_start: number | null;
|
|
556
|
-
}, {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
556
|
+
}, {}, {}>>[0]) => _ai_sdk_provider_utils.Experimental_ToolCallerTool<_ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
557
557
|
type: "programmatic-tool-call";
|
|
558
558
|
code: string;
|
|
559
559
|
} | {
|
|
@@ -615,7 +615,7 @@ declare const anthropicTools: {
|
|
|
615
615
|
new_start: number | null;
|
|
616
616
|
old_lines: number | null;
|
|
617
617
|
old_start: number | null;
|
|
618
|
-
}, {}
|
|
618
|
+
}, {}>>;
|
|
619
619
|
/**
|
|
620
620
|
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
621
621
|
* run system commands, create and edit files, and process uploaded files directly within
|
|
@@ -699,7 +699,7 @@ declare const anthropicTools: {
|
|
|
699
699
|
new_start: number | null;
|
|
700
700
|
old_lines: number | null;
|
|
701
701
|
old_start: number | null;
|
|
702
|
-
}, {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
702
|
+
}, {}, {}>>[0]) => _ai_sdk_provider_utils.Experimental_ToolCallerTool<_ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
703
703
|
type: "programmatic-tool-call";
|
|
704
704
|
code: string;
|
|
705
705
|
} | {
|
|
@@ -770,7 +770,7 @@ declare const anthropicTools: {
|
|
|
770
770
|
new_start: number | null;
|
|
771
771
|
old_lines: number | null;
|
|
772
772
|
old_start: number | null;
|
|
773
|
-
}, {}
|
|
773
|
+
}, {}>>;
|
|
774
774
|
/**
|
|
775
775
|
* Claude can interact with computer environments through the computer use tool, which
|
|
776
776
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
package/dist/index.js
CHANGED
|
@@ -2074,6 +2074,7 @@ var codeExecution_20250522 = (args = {}) => {
|
|
|
2074
2074
|
// src/tool/code-execution_20250825.ts
|
|
2075
2075
|
import {
|
|
2076
2076
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory7,
|
|
2077
|
+
experimental_toolCaller,
|
|
2077
2078
|
lazySchema as lazySchema11,
|
|
2078
2079
|
zodSchema as zodSchema11
|
|
2079
2080
|
} from "@ai-sdk/provider-utils";
|
|
@@ -2181,12 +2182,31 @@ var factory8 = createProviderExecutedToolFactory7({
|
|
|
2181
2182
|
supportsDeferredResults: true
|
|
2182
2183
|
});
|
|
2183
2184
|
var codeExecution_20250825 = (args = {}) => {
|
|
2184
|
-
return factory8(args)
|
|
2185
|
+
return experimental_toolCaller(factory8(args), {
|
|
2186
|
+
type: "provider",
|
|
2187
|
+
prepareProviderOptions: (providerOptions) => {
|
|
2188
|
+
var _a;
|
|
2189
|
+
const anthropicOptions = providerOptions == null ? void 0 : providerOptions.anthropic;
|
|
2190
|
+
return {
|
|
2191
|
+
...providerOptions,
|
|
2192
|
+
anthropic: {
|
|
2193
|
+
...anthropicOptions,
|
|
2194
|
+
allowedCallers: [
|
|
2195
|
+
.../* @__PURE__ */ new Set([
|
|
2196
|
+
...(_a = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers) != null ? _a : [],
|
|
2197
|
+
"code_execution_20250825"
|
|
2198
|
+
])
|
|
2199
|
+
]
|
|
2200
|
+
}
|
|
2201
|
+
};
|
|
2202
|
+
}
|
|
2203
|
+
});
|
|
2185
2204
|
};
|
|
2186
2205
|
|
|
2187
2206
|
// src/tool/code-execution_20260120.ts
|
|
2188
2207
|
import {
|
|
2189
2208
|
createProviderExecutedToolFactory as createProviderExecutedToolFactory8,
|
|
2209
|
+
experimental_toolCaller as experimental_toolCaller2,
|
|
2190
2210
|
lazySchema as lazySchema12,
|
|
2191
2211
|
zodSchema as zodSchema12
|
|
2192
2212
|
} from "@ai-sdk/provider-utils";
|
|
@@ -2302,7 +2322,25 @@ var factory9 = createProviderExecutedToolFactory8({
|
|
|
2302
2322
|
supportsDeferredResults: true
|
|
2303
2323
|
});
|
|
2304
2324
|
var codeExecution_20260120 = (args = {}) => {
|
|
2305
|
-
return factory9(args)
|
|
2325
|
+
return experimental_toolCaller2(factory9(args), {
|
|
2326
|
+
type: "provider",
|
|
2327
|
+
prepareProviderOptions: (providerOptions) => {
|
|
2328
|
+
var _a;
|
|
2329
|
+
const anthropicOptions = providerOptions == null ? void 0 : providerOptions.anthropic;
|
|
2330
|
+
return {
|
|
2331
|
+
...providerOptions,
|
|
2332
|
+
anthropic: {
|
|
2333
|
+
...anthropicOptions,
|
|
2334
|
+
allowedCallers: [
|
|
2335
|
+
.../* @__PURE__ */ new Set([
|
|
2336
|
+
...(_a = anthropicOptions == null ? void 0 : anthropicOptions.allowedCallers) != null ? _a : [],
|
|
2337
|
+
"code_execution_20260120"
|
|
2338
|
+
])
|
|
2339
|
+
]
|
|
2340
|
+
}
|
|
2341
|
+
};
|
|
2342
|
+
}
|
|
2343
|
+
});
|
|
2306
2344
|
};
|
|
2307
2345
|
|
|
2308
2346
|
// src/tool/tool-search-regex_20251119.ts
|
|
@@ -3397,6 +3435,7 @@ function mapAnthropicStopReason({
|
|
|
3397
3435
|
}
|
|
3398
3436
|
|
|
3399
3437
|
// src/sanitize-json-schema.ts
|
|
3438
|
+
import { isRecord } from "@ai-sdk/provider-utils";
|
|
3400
3439
|
var SUPPORTED_STRING_FORMATS = /* @__PURE__ */ new Set([
|
|
3401
3440
|
"date-time",
|
|
3402
3441
|
"time",
|
|
@@ -3429,7 +3468,7 @@ function sanitizeJsonSchema(schema) {
|
|
|
3429
3468
|
return sanitizeSchema(schema);
|
|
3430
3469
|
}
|
|
3431
3470
|
function sanitizeDefinition(definition) {
|
|
3432
|
-
if (typeof definition === "boolean" || !
|
|
3471
|
+
if (typeof definition === "boolean" || !isRecord(definition)) {
|
|
3433
3472
|
return definition;
|
|
3434
3473
|
}
|
|
3435
3474
|
return sanitizeSchema(definition);
|
|
@@ -3538,9 +3577,6 @@ function formatConstraintValue(value) {
|
|
|
3538
3577
|
}
|
|
3539
3578
|
return JSON.stringify(value);
|
|
3540
3579
|
}
|
|
3541
|
-
function isPlainObject(value) {
|
|
3542
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3543
|
-
}
|
|
3544
3580
|
|
|
3545
3581
|
// src/anthropic-language-model.ts
|
|
3546
3582
|
function createCitationSource(citation, citationDocuments, generateId3) {
|
|
@@ -5686,7 +5722,10 @@ function resolveAnthropicReasoningConfig({
|
|
|
5686
5722
|
},
|
|
5687
5723
|
warnings
|
|
5688
5724
|
});
|
|
5689
|
-
return {
|
|
5725
|
+
return {
|
|
5726
|
+
thinking: { type: "adaptive", display: "summarized" },
|
|
5727
|
+
effort
|
|
5728
|
+
};
|
|
5690
5729
|
}
|
|
5691
5730
|
const budgetTokens = mapReasoningToProviderBudget({
|
|
5692
5731
|
reasoning,
|
|
@@ -6472,7 +6511,7 @@ var AnthropicSkills = class {
|
|
|
6472
6511
|
};
|
|
6473
6512
|
|
|
6474
6513
|
// src/version.ts
|
|
6475
|
-
var VERSION = true ? "4.0.
|
|
6514
|
+
var VERSION = true ? "4.0.26" : "0.0.0-test";
|
|
6476
6515
|
|
|
6477
6516
|
// src/anthropic-provider.ts
|
|
6478
6517
|
var ANTHROPIC_API_URL = "https://api.anthropic.com";
|