@ai-sdk/anthropic 4.0.0-canary.65 → 4.0.0

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 CHANGED
@@ -1,5 +1,102 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 832f86f: fix(anthropic): remove cacheCreationInputTokens from providerMetadata
8
+ - 34bd95d: feat(ai): add support for uploading provider skills using the provider references abstraction
9
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
10
+ - c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
11
+ - 3887c70: feat(provider): add new top-level reasoning parameter to spec and support it in `generateText` and `streamText`
12
+ - 8359612: Start v7 pre-release
13
+ - 04e9009: chore: make provider implementations code patterns more consistent, including renaming certain exported symbols
14
+
15
+ For all externally exported symbols that were renamed, the old names continue to work via deprecated aliases.
16
+
17
+ ### Patch Changes
18
+
19
+ - e02f041: feat(provider/anthropic): add support for `claude-opus-4-8`
20
+ - 648705c: fix(provider/anthropic): fix remaining errors with Anthropic `code_execution` tool dynamic calls from latest `web_fetch` or `web_search`
21
+ - 38fc777: Add AI Gateway hint to provider READMEs
22
+ - ee798eb: chore(provider-utils): rename `Experimental_Sandbox` to `Experimental_SandboxSession`
23
+ - e748b35: chore: update v3 specs to v4
24
+ - 19c5ee2: fix(anthropic): reorder assistant content b/w client and provider tool use
25
+ - 0ee8aec: feat (provider/anthropic): support passing metadata.user_id
26
+ - c012d57: feat(anthropic): sanitize the unsupported JSON schema validation properties
27
+ - 8018480: feat(anthropic): add the new advisor tool
28
+ - e5c4f40: Remove stale `effort-2025-11-24` beta header — the extended thinking effort parameter is GA and no longer requires the beta flag. Vertex AI's strict validator was actively rejecting requests with this header.
29
+ - f57c702: fix(anthropic): allow both temperature and topP for non-Anthropic models using the Anthropic-compatible API
30
+
31
+ The temperature/topP mutual exclusivity check now only applies to known Anthropic models (model IDs starting with `claude-`). Non-Anthropic models using the Anthropic-compatible API (e.g. Minimax) can now send both parameters as required by their APIs.
32
+
33
+ - 2610e84: feat(provider/anthropic): automatically use sandbox in bash tool
34
+ - d848405: feat: add optional `abortSignal` parameters to sandbox command execution
35
+ - 87d1723: chore(anthropic): remove unnecessary messages affix from Anthropic symbols and files
36
+ - 9f0e36c: trigger release for all packages after provenance setup
37
+ - acdbf84: Handle errors from anthropic websearch tool
38
+ - ad0b376: fix(provider/anthropic): stop adding `fine-grained-tool-streaming-2025-05-14` beta for `claude-opus-4-7`
39
+ - 58a2ad7: fix: more precise default message for tool execution denial
40
+ - 21d1ee3: fix(anthropic): skip passing beta header for tool search tools
41
+ - 1fe058b: fix(anthropic): preserve the error code returned by model
42
+ - 7fc6bd6: Raise minimum supported Node.js version to 22. Supported versions: 22, 24, and 26.
43
+ - 09bd27b: feat (provider/anthropic): add support for inference_geo provider option
44
+ - 0c4c275: trigger initial canary release
45
+ - 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
46
+ - e311194: feat(ai): allow passing provider instance to `uploadFile` and `uploadSkill` as shorthand
47
+ - 6c93e36: feat(provider-utils): add `spawnCommand` method to `Experimental_Sandbox` to allow for detached command execution
48
+ - 9bd6512: feat(provider): change file part data property to be tagged with a type and remove the image part type
49
+ - 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
50
+ - 5463d0d: feat(provider): align tool result output content file part types with top-level message file part types
51
+ - b8396f0: trigger initial beta release
52
+ - 6b4d325: feat(provider/anthropic): add support for `claude-fable-5` and the `fallbacks` API parameter
53
+ - f05a40d: fix(vertex): throw warning when strict: true for vertexAnthropic
54
+ - a6617c5: feat(provider-utils): add `readFile` and `writeFile` plus convenience wrappers to `Experimental_Sandbox` abstraction
55
+ - a464505: fix(anthropic): propagate toModelOutput providerOption to anthropic tool results
56
+ - 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
57
+ - b3976a2: Add workflow serialization support to all provider models.
58
+
59
+ **`@ai-sdk/provider-utils`:** New `serializeModel()` helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.
60
+
61
+ **All providers:** `headers` is now optional in provider config types. This is non-breaking — existing code that passes `headers` continues to work. Custom provider implementations that construct model configs manually can now omit `headers`, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.
62
+
63
+ All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
64
+
65
+ - 0d8f107: feat(provider/anthropic): add support for Opus 4.7 and relevant API enhancements
66
+ - ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
67
+
68
+ ## 4.0.0-beta.69
69
+
70
+ ### Patch Changes
71
+
72
+ - 19c5ee2: fix(anthropic): reorder assistant content b/w client and provider tool use
73
+
74
+ ## 4.0.0-beta.68
75
+
76
+ ### Patch Changes
77
+
78
+ - Updated dependencies [0416e3e]
79
+ - @ai-sdk/provider@4.0.0-beta.20
80
+ - @ai-sdk/provider-utils@5.0.0-beta.50
81
+
82
+ ## 4.0.0-beta.67
83
+
84
+ ### Patch Changes
85
+
86
+ - b8396f0: trigger initial beta release
87
+ - Updated dependencies [b8396f0]
88
+ - @ai-sdk/provider-utils@5.0.0-beta.49
89
+ - @ai-sdk/provider@4.0.0-beta.19
90
+
91
+ ## 4.0.0-canary.66
92
+
93
+ ### Patch Changes
94
+
95
+ - Updated dependencies [aeda373]
96
+ - Updated dependencies [375fdd7]
97
+ - Updated dependencies [b4507d5]
98
+ - @ai-sdk/provider-utils@5.0.0-canary.48
99
+
3
100
  ## 4.0.0-canary.65
4
101
 
5
102
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3205,7 +3205,10 @@ async function convertToAnthropicPrompt({
3205
3205
  }
3206
3206
  }
3207
3207
  }
3208
- messages.push({ role: "assistant", content: anthropicContent });
3208
+ messages.push({
3209
+ role: "assistant",
3210
+ content: moveToolUseBlocksToEnd(anthropicContent)
3211
+ });
3209
3212
  break;
3210
3213
  }
3211
3214
  default: {
@@ -3265,6 +3268,27 @@ function groupIntoBlocks(prompt) {
3265
3268
  }
3266
3269
  return blocks;
3267
3270
  }
3271
+ function moveToolUseBlocksToEnd(content) {
3272
+ const result = [];
3273
+ let segment = [];
3274
+ function flushSegment() {
3275
+ result.push(
3276
+ ...segment.filter((part) => part.type !== "tool_use"),
3277
+ ...segment.filter((part) => part.type === "tool_use")
3278
+ );
3279
+ segment = [];
3280
+ }
3281
+ for (const part of content) {
3282
+ if (part.type === "thinking" || part.type === "redacted_thinking") {
3283
+ flushSegment();
3284
+ result.push(part);
3285
+ } else {
3286
+ segment.push(part);
3287
+ }
3288
+ }
3289
+ flushSegment();
3290
+ return result;
3291
+ }
3268
3292
 
3269
3293
  // src/map-anthropic-stop-reason.ts
3270
3294
  function mapAnthropicStopReason({
@@ -6263,7 +6287,7 @@ var AnthropicSkills = class {
6263
6287
  };
6264
6288
 
6265
6289
  // src/version.ts
6266
- var VERSION = true ? "4.0.0-canary.65" : "0.0.0-test";
6290
+ var VERSION = true ? "4.0.0" : "0.0.0-test";
6267
6291
 
6268
6292
  // src/anthropic-provider.ts
6269
6293
  function createAnthropic(options = {}) {