@ai-sdk/anthropic 4.0.83 → 4.0.84
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 +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -92
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +33 -13
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +107 -91
- package/dist/internal/index.js.map +1 -1
- package/package.json +4 -3
- package/src/anthropic-api.ts +8 -0
- package/src/anthropic-language-model.ts +31 -8
- package/src/convert-to-anthropic-prompt.ts +22 -0
- package/src/get-cache-control.ts +15 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 4.0.84
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9d13c4d: Add the MiniMax M3.1 Flash model ID to the MiniMax and AI Gateway providers.
|
|
8
|
+
- Updated dependencies [0c2a9de]
|
|
9
|
+
- Updated dependencies [200c47f]
|
|
10
|
+
- @ai-sdk/provider@4.0.31
|
|
11
|
+
- @ai-sdk/provider-utils@5.0.64
|
|
12
|
+
|
|
3
13
|
## 4.0.83
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["SandboxSession","SandboxSession","_$__tool_computer_toolset_202608010.ComputerToolset_20260801Member","DecisionModelV4","BatchV4"],"sources":["../src/anthropic-api.ts","../src/anthropic-message-metadata.ts","../src/anthropic-provider-metadata.ts","../src/anthropic-language-model-options.ts","../src/anthropic-prepare-tools.ts","../src/tool/computer-toolset_20260801.ts","../src/tool/bash_20241022.ts","../src/tool/bash_20250124.ts","../src/anthropic-tools.ts","../src/anthropic-provider.ts","../src/forward-anthropic-container-id-from-last-step.ts","../src/version.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["SandboxSession","SandboxSession","_$__tool_computer_toolset_202608010.ComputerToolset_20260801Member","DecisionModelV4","BatchV4"],"sources":["../src/anthropic-api.ts","../src/anthropic-message-metadata.ts","../src/anthropic-provider-metadata.ts","../src/anthropic-language-model-options.ts","../src/anthropic-prepare-tools.ts","../src/tool/computer-toolset_20260801.ts","../src/tool/bash_20241022.ts","../src/tool/bash_20250124.ts","../src/anthropic-tools.ts","../src/anthropic-provider.ts","../src/forward-anthropic-container-id-from-last-step.ts","../src/version.ts"],"mappings":";;;;cA4rBM,gCAA8B,EAAA;;;;;;;;;;GAelC,EAAA,KAAA;KAEU,2BAA2B,EAAE,aAChC;cAuFI,0DAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8vBxB,WAAW,aACpB,mBAAmB;EAClB;;;;;;;;;;;;;;;;;;;KCnhDQ;EACV;;;;;;EAOA;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;;UAGe;EACf,OAAO;EACP;;;;;;;EAQA,uBAAuB;IACrB;IACA;IACA;;;;;;;;;;;;;EAcF,mBAAmB;;;;;;;;;;EAWnB;;;;;IAKE;;;;;IAMA;;;;;IAMA;;;;;;IAOA;;;;;;;;;EAUF,YAAY;;;;;;;EAQZ;;;;IAIE;;;;IAKA;;;;IAKA,QAAQ;;;;MAIN;;;;MA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;;;;;;;;;;;;;;;;;;;;;;;;;;;MAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAQP;MACF;MACJ;MAEwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAJlB;MACF;MACJ;MAEwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAHxB;MACA;MAEa;MACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UCJJ,0BAA0B;;;;GAIxC,SAAS,mBAAmB;;;;EAK7B,cAAc,SAAS,mBAAmB;EAE1C,KAAK,SAAS,mBAAmB;EAEjC,SAAS,SAAS,mBAAmB;;EAGrC,cAAc,SAAS,mBAAmBE;;EAE1C,gBAAgB,SAAS,mBAAmBA;IAC1C,YAAYA;;EAGd,sBAAsBC;IAAU,MAAM;;;;;EAKtC,mBAAmB;EAEnB,SAAS;;;;EAKT,UAAU;;;;EAKV,cAAc;;UAGC;;EAEf;;IAEE;;;;;;EAOF;;;;;;EAOA;;;;;;EAOA;;;;EAKA,UAAU;;;;;EAMV,QAAQ;EAER;;;;;EAMA;;;;;wBAMc,gBACd,UAAS,4BACR;;;;qBA0HU,WAAS;;;;;;;;;;wBCvPN,0CACd;EAEA,OAAO;IACL,mBAAmB,eAAe;;;EAEpB,kBAAkB,eAAe;;;;qBCdtC"}
|
package/dist/index.js
CHANGED
|
@@ -1135,17 +1135,19 @@ userId: z.string().optional() }).optional(),
|
|
|
1135
1135
|
//#endregion
|
|
1136
1136
|
//#region src/get-cache-control.ts
|
|
1137
1137
|
const MAX_CACHE_BREAKPOINTS = 4;
|
|
1138
|
-
function getCacheControl(providerMetadata) {
|
|
1138
|
+
function getCacheControl(providerMetadata, providerOptionsName) {
|
|
1139
|
+
const custom = providerMetadata?.[providerOptionsName];
|
|
1139
1140
|
const anthropic = providerMetadata?.anthropic;
|
|
1140
|
-
return anthropic?.cacheControl ?? anthropic?.cache_control;
|
|
1141
|
+
return custom?.cacheControl ?? custom?.cache_control ?? anthropic?.cacheControl ?? anthropic?.cache_control;
|
|
1141
1142
|
}
|
|
1142
1143
|
var CacheControlValidator = class {
|
|
1143
|
-
constructor() {
|
|
1144
|
+
constructor(providerOptionsName = "anthropic") {
|
|
1145
|
+
this.providerOptionsName = providerOptionsName;
|
|
1144
1146
|
this.breakpointCount = 0;
|
|
1145
1147
|
this.warnings = [];
|
|
1146
1148
|
}
|
|
1147
1149
|
getCacheControl(providerMetadata, context) {
|
|
1148
|
-
const cacheControlValue = getCacheControl(providerMetadata);
|
|
1150
|
+
const cacheControlValue = getCacheControl(providerMetadata, this.providerOptionsName);
|
|
1149
1151
|
if (!cacheControlValue) return;
|
|
1150
1152
|
if (!context.canCache) {
|
|
1151
1153
|
this.warnings.push({
|
|
@@ -2266,7 +2268,7 @@ function extractErrorValue(value) {
|
|
|
2266
2268
|
}
|
|
2267
2269
|
return {};
|
|
2268
2270
|
}
|
|
2269
|
-
async function convertToAnthropicPrompt({ prompt, sendReasoning, warnings, cacheControlValidator, toolNameMapping, toolsetNames = {} }) {
|
|
2271
|
+
async function convertToAnthropicPrompt({ prompt, sendReasoning, warnings, cacheControlValidator, toolNameMapping, toolsetNames = {}, convertMediaPart }) {
|
|
2270
2272
|
const betas = /* @__PURE__ */ new Set();
|
|
2271
2273
|
const blocks = groupIntoBlocks(prompt);
|
|
2272
2274
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -2395,107 +2397,118 @@ async function convertToAnthropicPrompt({ prompt, sendReasoning, warnings, cache
|
|
|
2395
2397
|
cache_control: cacheControl
|
|
2396
2398
|
});
|
|
2397
2399
|
break;
|
|
2398
|
-
case "file":
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
reference: part.data.reference,
|
|
2402
|
-
provider: "anthropic"
|
|
2403
|
-
});
|
|
2404
|
-
betas.add("files-api-2025-04-14");
|
|
2405
|
-
if (await shouldUseContainerUpload(part.providerOptions)) anthropicContent.push({
|
|
2406
|
-
type: "container_upload",
|
|
2407
|
-
file_id: fileId
|
|
2408
|
-
});
|
|
2409
|
-
else if (getTopLevelMediaType(part.mediaType) === "image") anthropicContent.push({
|
|
2410
|
-
type: "image",
|
|
2411
|
-
source: {
|
|
2412
|
-
type: "file",
|
|
2413
|
-
file_id: fileId
|
|
2414
|
-
},
|
|
2415
|
-
cache_control: cacheControl
|
|
2416
|
-
});
|
|
2417
|
-
else anthropicContent.push({
|
|
2418
|
-
type: "document",
|
|
2419
|
-
source: {
|
|
2420
|
-
type: "file",
|
|
2421
|
-
file_id: fileId
|
|
2422
|
-
},
|
|
2423
|
-
cache_control: cacheControl
|
|
2424
|
-
});
|
|
2425
|
-
break;
|
|
2426
|
-
}
|
|
2427
|
-
case "text": {
|
|
2428
|
-
const enableCitations = await shouldEnableCitations(part.providerOptions);
|
|
2429
|
-
const metadata = await getDocumentMetadata(part.providerOptions);
|
|
2400
|
+
case "file": {
|
|
2401
|
+
const convertedPart = await convertMediaPart?.(part);
|
|
2402
|
+
if (convertedPart != null) {
|
|
2430
2403
|
anthropicContent.push({
|
|
2431
|
-
|
|
2432
|
-
source: {
|
|
2433
|
-
type: "text",
|
|
2434
|
-
media_type: "text/plain",
|
|
2435
|
-
data: part.data.text
|
|
2436
|
-
},
|
|
2437
|
-
title: metadata.title ?? part.filename,
|
|
2438
|
-
...metadata.context && { context: metadata.context },
|
|
2439
|
-
...enableCitations && { citations: { enabled: true } },
|
|
2404
|
+
...convertedPart,
|
|
2440
2405
|
cache_control: cacheControl
|
|
2441
2406
|
});
|
|
2442
2407
|
break;
|
|
2443
2408
|
}
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2409
|
+
switch (part.data.type) {
|
|
2410
|
+
case "reference": {
|
|
2411
|
+
const fileId = resolveProviderReference({
|
|
2412
|
+
reference: part.data.reference,
|
|
2413
|
+
provider: "anthropic"
|
|
2414
|
+
});
|
|
2415
|
+
betas.add("files-api-2025-04-14");
|
|
2416
|
+
if (await shouldUseContainerUpload(part.providerOptions)) anthropicContent.push({
|
|
2417
|
+
type: "container_upload",
|
|
2418
|
+
file_id: fileId
|
|
2419
|
+
});
|
|
2420
|
+
else if (getTopLevelMediaType(part.mediaType) === "image") anthropicContent.push({
|
|
2421
|
+
type: "image",
|
|
2422
|
+
source: {
|
|
2423
|
+
type: "file",
|
|
2424
|
+
file_id: fileId
|
|
2425
|
+
},
|
|
2426
|
+
cache_control: cacheControl
|
|
2427
|
+
});
|
|
2428
|
+
else anthropicContent.push({
|
|
2429
|
+
type: "document",
|
|
2430
|
+
source: {
|
|
2431
|
+
type: "file",
|
|
2432
|
+
file_id: fileId
|
|
2433
|
+
},
|
|
2434
|
+
cache_control: cacheControl
|
|
2435
|
+
});
|
|
2436
|
+
break;
|
|
2437
|
+
}
|
|
2438
|
+
case "text": {
|
|
2461
2439
|
const enableCitations = await shouldEnableCitations(part.providerOptions);
|
|
2462
2440
|
const metadata = await getDocumentMetadata(part.providerOptions);
|
|
2463
2441
|
anthropicContent.push({
|
|
2464
2442
|
type: "document",
|
|
2465
|
-
source:
|
|
2466
|
-
type: "
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
type: "base64",
|
|
2470
|
-
media_type: "application/pdf",
|
|
2471
|
-
data: convertToBase64(part.data.data)
|
|
2443
|
+
source: {
|
|
2444
|
+
type: "text",
|
|
2445
|
+
media_type: "text/plain",
|
|
2446
|
+
data: part.data.text
|
|
2472
2447
|
},
|
|
2473
2448
|
title: metadata.title ?? part.filename,
|
|
2474
2449
|
...metadata.context && { context: metadata.context },
|
|
2475
2450
|
...enableCitations && { citations: { enabled: true } },
|
|
2476
2451
|
cache_control: cacheControl
|
|
2477
2452
|
});
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2453
|
+
break;
|
|
2454
|
+
}
|
|
2455
|
+
case "url":
|
|
2456
|
+
case "data": {
|
|
2457
|
+
const topLevel = getTopLevelMediaType(part.mediaType);
|
|
2458
|
+
if (topLevel === "image") anthropicContent.push({
|
|
2459
|
+
type: "image",
|
|
2483
2460
|
source: part.data.type === "url" ? {
|
|
2484
2461
|
type: "url",
|
|
2485
2462
|
url: part.data.url.toString()
|
|
2486
2463
|
} : {
|
|
2487
|
-
type: "
|
|
2488
|
-
media_type:
|
|
2489
|
-
data:
|
|
2464
|
+
type: "base64",
|
|
2465
|
+
media_type: resolveFullMediaType({ part }),
|
|
2466
|
+
data: convertToBase64(part.data.data)
|
|
2490
2467
|
},
|
|
2491
|
-
title: metadata.title ?? part.filename,
|
|
2492
|
-
...metadata.context && { context: metadata.context },
|
|
2493
|
-
...enableCitations && { citations: { enabled: true } },
|
|
2494
2468
|
cache_control: cacheControl
|
|
2495
2469
|
});
|
|
2496
|
-
|
|
2497
|
-
|
|
2470
|
+
else if (topLevel === "application" && (part.data.type === "url" ? part.mediaType === "application/pdf" : resolveFullMediaType({ part }) === "application/pdf")) {
|
|
2471
|
+
betas.add("pdfs-2024-09-25");
|
|
2472
|
+
const enableCitations = await shouldEnableCitations(part.providerOptions);
|
|
2473
|
+
const metadata = await getDocumentMetadata(part.providerOptions);
|
|
2474
|
+
anthropicContent.push({
|
|
2475
|
+
type: "document",
|
|
2476
|
+
source: part.data.type === "url" ? {
|
|
2477
|
+
type: "url",
|
|
2478
|
+
url: part.data.url.toString()
|
|
2479
|
+
} : {
|
|
2480
|
+
type: "base64",
|
|
2481
|
+
media_type: "application/pdf",
|
|
2482
|
+
data: convertToBase64(part.data.data)
|
|
2483
|
+
},
|
|
2484
|
+
title: metadata.title ?? part.filename,
|
|
2485
|
+
...metadata.context && { context: metadata.context },
|
|
2486
|
+
...enableCitations && { citations: { enabled: true } },
|
|
2487
|
+
cache_control: cacheControl
|
|
2488
|
+
});
|
|
2489
|
+
} else if (part.mediaType === "text/plain") {
|
|
2490
|
+
const enableCitations = await shouldEnableCitations(part.providerOptions);
|
|
2491
|
+
const metadata = await getDocumentMetadata(part.providerOptions);
|
|
2492
|
+
anthropicContent.push({
|
|
2493
|
+
type: "document",
|
|
2494
|
+
source: part.data.type === "url" ? {
|
|
2495
|
+
type: "url",
|
|
2496
|
+
url: part.data.url.toString()
|
|
2497
|
+
} : {
|
|
2498
|
+
type: "text",
|
|
2499
|
+
media_type: "text/plain",
|
|
2500
|
+
data: convertBytesDataToString(part.data.data)
|
|
2501
|
+
},
|
|
2502
|
+
title: metadata.title ?? part.filename,
|
|
2503
|
+
...metadata.context && { context: metadata.context },
|
|
2504
|
+
...enableCitations && { citations: { enabled: true } },
|
|
2505
|
+
cache_control: cacheControl
|
|
2506
|
+
});
|
|
2507
|
+
} else throw new UnsupportedFunctionalityError({ functionality: `media type: ${part.mediaType}` });
|
|
2508
|
+
break;
|
|
2509
|
+
}
|
|
2498
2510
|
}
|
|
2511
|
+
break;
|
|
2499
2512
|
}
|
|
2500
2513
|
}
|
|
2501
2514
|
}
|
|
@@ -3565,18 +3578,20 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
|
|
|
3565
3578
|
type: "unsupported",
|
|
3566
3579
|
feature: "seed"
|
|
3567
3580
|
});
|
|
3568
|
-
|
|
3581
|
+
const maxTemperature = config.maxTemperature ?? 1;
|
|
3582
|
+
const temperatureProvider = config.maxTemperature == null ? "anthropic" : getProviderOptionsName(config.provider);
|
|
3583
|
+
if (temperature != null && temperature > maxTemperature) {
|
|
3569
3584
|
warnings.push({
|
|
3570
3585
|
type: "unsupported",
|
|
3571
3586
|
feature: "temperature",
|
|
3572
|
-
details: `${temperature} exceeds
|
|
3587
|
+
details: `${temperature} exceeds ${temperatureProvider} maximum of ${maxTemperature.toFixed(1)}. clamped to ${maxTemperature.toFixed(1)}`
|
|
3573
3588
|
});
|
|
3574
|
-
temperature =
|
|
3589
|
+
temperature = maxTemperature;
|
|
3575
3590
|
} else if (temperature != null && temperature < 0) {
|
|
3576
3591
|
warnings.push({
|
|
3577
3592
|
type: "unsupported",
|
|
3578
3593
|
feature: "temperature",
|
|
3579
|
-
details: `${temperature} is below
|
|
3594
|
+
details: `${temperature} is below ${temperatureProvider} minimum of 0. clamped to 0`
|
|
3580
3595
|
});
|
|
3581
3596
|
temperature = 0;
|
|
3582
3597
|
}
|
|
@@ -3662,7 +3677,7 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
|
|
|
3662
3677
|
argument: "providerOptions",
|
|
3663
3678
|
message: "Anthropic provider options `compaction` and `contextManagement` cannot be used together."
|
|
3664
3679
|
});
|
|
3665
|
-
const cacheControlValidator = new CacheControlValidator();
|
|
3680
|
+
const cacheControlValidator = new CacheControlValidator(config.cacheControlProviderOptionsName);
|
|
3666
3681
|
const toolNameMapping = createToolNameMapping({
|
|
3667
3682
|
tools,
|
|
3668
3683
|
providerToolNames: {
|
|
@@ -3698,7 +3713,8 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
|
|
|
3698
3713
|
warnings,
|
|
3699
3714
|
cacheControlValidator,
|
|
3700
3715
|
toolNameMapping,
|
|
3701
|
-
toolsetNames
|
|
3716
|
+
toolsetNames,
|
|
3717
|
+
convertMediaPart: config.convertMediaPart
|
|
3702
3718
|
});
|
|
3703
3719
|
if (isCustomReasoning(reasoning) && anthropicOptions?.effort == null) {
|
|
3704
3720
|
const reasoningConfig = resolveAnthropicReasoningConfig({
|
|
@@ -3870,7 +3886,7 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
|
|
|
3870
3886
|
};
|
|
3871
3887
|
thinkingBudget = 1024;
|
|
3872
3888
|
}
|
|
3873
|
-
if (baseArgs.temperature != null) {
|
|
3889
|
+
if (baseArgs.temperature != null && !config.supportsTemperatureAndTopPWithThinking) {
|
|
3874
3890
|
baseArgs.temperature = void 0;
|
|
3875
3891
|
warnings.push({
|
|
3876
3892
|
type: "unsupported",
|
|
@@ -3886,7 +3902,7 @@ var AnthropicLanguageModel = class AnthropicLanguageModel {
|
|
|
3886
3902
|
details: "topK is not supported when thinking is enabled"
|
|
3887
3903
|
});
|
|
3888
3904
|
}
|
|
3889
|
-
if (topP != null) {
|
|
3905
|
+
if (topP != null && !config.supportsTemperatureAndTopPWithThinking) {
|
|
3890
3906
|
baseArgs.top_p = void 0;
|
|
3891
3907
|
warnings.push({
|
|
3892
3908
|
type: "unsupported",
|
|
@@ -6957,7 +6973,7 @@ var AnthropicSkills = class {
|
|
|
6957
6973
|
};
|
|
6958
6974
|
//#endregion
|
|
6959
6975
|
//#region src/version.ts
|
|
6960
|
-
const VERSION = "4.0.
|
|
6976
|
+
const VERSION = "4.0.84";
|
|
6961
6977
|
//#endregion
|
|
6962
6978
|
//#region src/anthropic-provider.ts
|
|
6963
6979
|
const ANTHROPIC_API_URL = "https://api.anthropic.com";
|