@ai-sdk/anthropic 4.0.1 → 4.0.3

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,19 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 4.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [0274f34]
8
+ - @ai-sdk/provider@4.0.1
9
+ - @ai-sdk/provider-utils@5.0.2
10
+
11
+ ## 4.0.2
12
+
13
+ ### Patch Changes
14
+
15
+ - dfffb27: fix(anthropic): correctly map delta type when code execution tools are used
16
+
3
17
  ## 4.0.1
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -4704,6 +4704,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
4704
4704
  "bash_code_execution"
4705
4705
  ].includes(part.name)) {
4706
4706
  const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
4707
+ const providerToolInputType = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? part.name : part.name === "code_execution" ? "programmatic-tool-call" : void 0;
4707
4708
  const customToolName = toolNameMapping.toCustomToolName(providerToolName);
4708
4709
  const finalInput = part.input != null && typeof part.input === "object" && Object.keys(part.input).length > 0 ? JSON.stringify(part.input) : "";
4709
4710
  contentBlocks[value.index] = {
@@ -4717,8 +4718,9 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
4717
4718
  // tool was not explicitly provided. We therefore bypass the general validation by marking the
4718
4719
  // tool as dynamic.
4719
4720
  ...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {},
4720
- firstDelta: true,
4721
- providerToolName
4721
+ firstDelta: finalInput.length === 0,
4722
+ providerToolName,
4723
+ providerToolInputType
4722
4724
  };
4723
4725
  controller.enqueue({
4724
4726
  type: "tool-input-start",
@@ -5158,8 +5160,8 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
5158
5160
  if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
5159
5161
  return;
5160
5162
  }
5161
- if (contentBlock.firstDelta && contentBlock.providerToolName === "code_execution") {
5162
- delta = `{"type": "programmatic-tool-call",${delta.substring(1)}`;
5163
+ if (contentBlock.firstDelta && contentBlock.providerToolInputType != null) {
5164
+ delta = `{"type": "${contentBlock.providerToolInputType}",${delta.substring(1)}`;
5163
5165
  }
5164
5166
  controller.enqueue({
5165
5167
  type: "tool-input-delta",
@@ -6287,7 +6289,7 @@ var AnthropicSkills = class {
6287
6289
  };
6288
6290
 
6289
6291
  // src/version.ts
6290
- var VERSION = true ? "4.0.1" : "0.0.0-test";
6292
+ var VERSION = true ? "4.0.3" : "0.0.0-test";
6291
6293
 
6292
6294
  // src/anthropic-provider.ts
6293
6295
  function createAnthropic(options = {}) {