@ai-sdk/anthropic 4.0.0-canary.66 → 4.0.1

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,100 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 4.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [6a436e3]
8
+ - @ai-sdk/provider-utils@5.0.1
9
+
10
+ ## 4.0.0
11
+
12
+ ### Major Changes
13
+
14
+ - 832f86f: fix(anthropic): remove cacheCreationInputTokens from providerMetadata
15
+ - 34bd95d: feat(ai): add support for uploading provider skills using the provider references abstraction
16
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
17
+ - c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
18
+ - 3887c70: feat(provider): add new top-level reasoning parameter to spec and support it in `generateText` and `streamText`
19
+ - 8359612: Start v7 pre-release
20
+ - 04e9009: chore: make provider implementations code patterns more consistent, including renaming certain exported symbols
21
+
22
+ For all externally exported symbols that were renamed, the old names continue to work via deprecated aliases.
23
+
24
+ ### Patch Changes
25
+
26
+ - e02f041: feat(provider/anthropic): add support for `claude-opus-4-8`
27
+ - 648705c: fix(provider/anthropic): fix remaining errors with Anthropic `code_execution` tool dynamic calls from latest `web_fetch` or `web_search`
28
+ - 38fc777: Add AI Gateway hint to provider READMEs
29
+ - ee798eb: chore(provider-utils): rename `Experimental_Sandbox` to `Experimental_SandboxSession`
30
+ - e748b35: chore: update v3 specs to v4
31
+ - 19c5ee2: fix(anthropic): reorder assistant content b/w client and provider tool use
32
+ - 0ee8aec: feat (provider/anthropic): support passing metadata.user_id
33
+ - c012d57: feat(anthropic): sanitize the unsupported JSON schema validation properties
34
+ - 8018480: feat(anthropic): add the new advisor tool
35
+ - 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.
36
+ - f57c702: fix(anthropic): allow both temperature and topP for non-Anthropic models using the Anthropic-compatible API
37
+
38
+ 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.
39
+
40
+ - 2610e84: feat(provider/anthropic): automatically use sandbox in bash tool
41
+ - d848405: feat: add optional `abortSignal` parameters to sandbox command execution
42
+ - 87d1723: chore(anthropic): remove unnecessary messages affix from Anthropic symbols and files
43
+ - 9f0e36c: trigger release for all packages after provenance setup
44
+ - acdbf84: Handle errors from anthropic websearch tool
45
+ - ad0b376: fix(provider/anthropic): stop adding `fine-grained-tool-streaming-2025-05-14` beta for `claude-opus-4-7`
46
+ - 58a2ad7: fix: more precise default message for tool execution denial
47
+ - 21d1ee3: fix(anthropic): skip passing beta header for tool search tools
48
+ - 1fe058b: fix(anthropic): preserve the error code returned by model
49
+ - 7fc6bd6: Raise minimum supported Node.js version to 22. Supported versions: 22, 24, and 26.
50
+ - 09bd27b: feat (provider/anthropic): add support for inference_geo provider option
51
+ - 0c4c275: trigger initial canary release
52
+ - 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
53
+ - e311194: feat(ai): allow passing provider instance to `uploadFile` and `uploadSkill` as shorthand
54
+ - 6c93e36: feat(provider-utils): add `spawnCommand` method to `Experimental_Sandbox` to allow for detached command execution
55
+ - 9bd6512: feat(provider): change file part data property to be tagged with a type and remove the image part type
56
+ - 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
57
+ - 5463d0d: feat(provider): align tool result output content file part types with top-level message file part types
58
+ - b8396f0: trigger initial beta release
59
+ - 6b4d325: feat(provider/anthropic): add support for `claude-fable-5` and the `fallbacks` API parameter
60
+ - f05a40d: fix(vertex): throw warning when strict: true for vertexAnthropic
61
+ - a6617c5: feat(provider-utils): add `readFile` and `writeFile` plus convenience wrappers to `Experimental_Sandbox` abstraction
62
+ - a464505: fix(anthropic): propagate toModelOutput providerOption to anthropic tool results
63
+ - 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
64
+ - b3976a2: Add workflow serialization support to all provider models.
65
+
66
+ **`@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.
67
+
68
+ **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.
69
+
70
+ All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
71
+
72
+ - 0d8f107: feat(provider/anthropic): add support for Opus 4.7 and relevant API enhancements
73
+ - ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
74
+
75
+ ## 4.0.0-beta.69
76
+
77
+ ### Patch Changes
78
+
79
+ - 19c5ee2: fix(anthropic): reorder assistant content b/w client and provider tool use
80
+
81
+ ## 4.0.0-beta.68
82
+
83
+ ### Patch Changes
84
+
85
+ - Updated dependencies [0416e3e]
86
+ - @ai-sdk/provider@4.0.0-beta.20
87
+ - @ai-sdk/provider-utils@5.0.0-beta.50
88
+
89
+ ## 4.0.0-beta.67
90
+
91
+ ### Patch Changes
92
+
93
+ - b8396f0: trigger initial beta release
94
+ - Updated dependencies [b8396f0]
95
+ - @ai-sdk/provider-utils@5.0.0-beta.49
96
+ - @ai-sdk/provider@4.0.0-beta.19
97
+
3
98
  ## 4.0.0-canary.66
4
99
 
5
100
  ### 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.66" : "0.0.0-test";
6290
+ var VERSION = true ? "4.0.1" : "0.0.0-test";
6267
6291
 
6268
6292
  // src/anthropic-provider.ts
6269
6293
  function createAnthropic(options = {}) {