@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 +15 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -6
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +7 -5
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +7 -5
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +2 -1
- package/package.json +3 -3
- package/src/anthropic-messages-language-model.ts +14 -4
- package/src/anthropic-messages-options.ts +1 -0
|
@@ -2,7 +2,7 @@ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateRes
|
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
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 & {});
|
|
5
|
+
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 & {});
|
|
6
6
|
|
|
7
7
|
type AnthropicMessagesConfig = {
|
|
8
8
|
provider: string;
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateRes
|
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
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 & {});
|
|
5
|
+
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 & {});
|
|
6
6
|
|
|
7
7
|
type AnthropicMessagesConfig = {
|
|
8
8
|
provider: string;
|
package/dist/internal/index.js
CHANGED
|
@@ -4453,6 +4453,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4453
4453
|
"bash_code_execution"
|
|
4454
4454
|
].includes(part.name)) {
|
|
4455
4455
|
const providerToolName = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? "code_execution" : part.name;
|
|
4456
|
+
const providerToolInputType = part.name === "text_editor_code_execution" || part.name === "bash_code_execution" ? part.name : part.name === "code_execution" ? "programmatic-tool-call" : void 0;
|
|
4456
4457
|
const customToolName = toolNameMapping.toCustomToolName(providerToolName);
|
|
4457
4458
|
const finalInput = part.input != null && typeof part.input === "object" && Object.keys(part.input).length > 0 ? JSON.stringify(part.input) : "";
|
|
4458
4459
|
contentBlocks[value.index] = {
|
|
@@ -4466,8 +4467,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4466
4467
|
// tool was not explicitly provided. We therefore bypass the general validation by marking the
|
|
4467
4468
|
// tool as dynamic.
|
|
4468
4469
|
...markCodeExecutionDynamic && providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
4469
|
-
firstDelta:
|
|
4470
|
-
providerToolName
|
|
4470
|
+
firstDelta: finalInput.length === 0,
|
|
4471
|
+
providerToolName,
|
|
4472
|
+
providerToolInputType
|
|
4471
4473
|
};
|
|
4472
4474
|
controller.enqueue({
|
|
4473
4475
|
type: "tool-input-start",
|
|
@@ -4907,8 +4909,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4907
4909
|
if ((contentBlock == null ? void 0 : contentBlock.type) !== "tool-call") {
|
|
4908
4910
|
return;
|
|
4909
4911
|
}
|
|
4910
|
-
if (contentBlock.firstDelta && contentBlock.
|
|
4911
|
-
delta = `{"type": "
|
|
4912
|
+
if (contentBlock.firstDelta && contentBlock.providerToolInputType != null) {
|
|
4913
|
+
delta = `{"type": "${contentBlock.providerToolInputType}",${delta.substring(1)}`;
|
|
4912
4914
|
}
|
|
4913
4915
|
controller.enqueue({
|
|
4914
4916
|
type: "tool-input-delta",
|
|
@@ -5137,7 +5139,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5137
5139
|
}
|
|
5138
5140
|
};
|
|
5139
5141
|
function getModelCapabilities(modelId) {
|
|
5140
|
-
if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5")) {
|
|
5142
|
+
if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-fable-5") || modelId.includes("claude-sonnet-5")) {
|
|
5141
5143
|
return {
|
|
5142
5144
|
maxOutputTokens: 128e3,
|
|
5143
5145
|
supportsStructuredOutput: true,
|