@ai-sdk/anthropic 3.0.89 → 3.0.91

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,20 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 3.0.91
4
+
5
+ ### Patch Changes
6
+
7
+ - 95bc6fd: feat (provider/anthropic): add `claude-sonnet-5` model id
8
+ - Updated dependencies [fa850e6]
9
+ - @ai-sdk/provider@3.0.13
10
+ - @ai-sdk/provider-utils@4.0.34
11
+
12
+ ## 3.0.90
13
+
14
+ ### Patch Changes
15
+
16
+ - 28ff5a7: fix(anthropic): correctly map delta type when code execution tools are used
17
+
3
18
  ## 3.0.89
4
19
 
5
20
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -184,7 +184,7 @@ interface AnthropicMessageMetadata {
184
184
  } | null;
185
185
  }
186
186
 
187
- type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-fable-5' | (string & {});
187
+ type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-fable-5' | 'claude-sonnet-5' | (string & {});
188
188
  declare const anthropicLanguageModelOptions: z.ZodObject<{
189
189
  sendReasoning: z.ZodOptional<z.ZodBoolean>;
190
190
  structuredOutputMode: z.ZodOptional<z.ZodEnum<{
package/dist/index.d.ts CHANGED
@@ -184,7 +184,7 @@ interface AnthropicMessageMetadata {
184
184
  } | null;
185
185
  }
186
186
 
187
- type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-fable-5' | (string & {});
187
+ type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-fable-5' | 'claude-sonnet-5' | (string & {});
188
188
  declare const anthropicLanguageModelOptions: z.ZodObject<{
189
189
  sendReasoning: z.ZodOptional<z.ZodBoolean>;
190
190
  structuredOutputMode: z.ZodOptional<z.ZodEnum<{
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
32
32
  var import_provider_utils26 = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/version.ts
35
- var VERSION = true ? "3.0.89" : "0.0.0-test";
35
+ var VERSION = true ? "3.0.91" : "0.0.0-test";
36
36
 
37
37
  // src/anthropic-messages-language-model.ts
38
38
  var import_provider3 = require("@ai-sdk/provider");
@@ -4461,6 +4461,7 @@ var AnthropicMessagesLanguageModel = class {
4461
4461
  "bash_code_execution"
4462
4462
  ].includes(part.name)) {
4463
4463
  const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
4464
+ const providerToolInputType = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? part.name : part.name === "code_execution" ? "programmatic-tool-call" : void 0;
4464
4465
  const customToolName = toolNameMapping.toCustomToolName(providerToolName);
4465
4466
  const finalInput = part.input != null && typeof part.input === "object" && Object.keys(part.input).length > 0 ? JSON.stringify(part.input) : "";
4466
4467
  contentBlocks[value.index] = {
@@ -4474,8 +4475,9 @@ var AnthropicMessagesLanguageModel = class {
4474
4475
  // tool was not explicitly provided. We therefore bypass the general validation by marking the
4475
4476
  // tool as dynamic.
4476
4477
  ...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {},
4477
- firstDelta: true,
4478
- providerToolName
4478
+ firstDelta: finalInput.length === 0,
4479
+ providerToolName,
4480
+ providerToolInputType
4479
4481
  };
4480
4482
  controller.enqueue({
4481
4483
  type: "tool-input-start",
@@ -4915,8 +4917,8 @@ var AnthropicMessagesLanguageModel = class {
4915
4917
  if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
4916
4918
  return;
4917
4919
  }
4918
- if (contentBlock.firstDelta && contentBlock.providerToolName === "code_execution") {
4919
- delta = `{"type": "programmatic-tool-call",${delta.substring(1)}`;
4920
+ if (contentBlock.firstDelta && contentBlock.providerToolInputType != null) {
4921
+ delta = `{"type": "${contentBlock.providerToolInputType}",${delta.substring(1)}`;
4920
4922
  }
4921
4923
  controller.enqueue({
4922
4924
  type: "tool-input-delta",
@@ -5145,7 +5147,7 @@ var AnthropicMessagesLanguageModel = class {
5145
5147
  }
5146
5148
  };
5147
5149
  function getModelCapabilities(modelId) {
5148
- if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5")) {
5150
+ if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
5149
5151
  return {
5150
5152
  maxOutputTokens: 128e3,
5151
5153
  supportsStructuredOutput: true,