@ai-sdk/amazon-bedrock 5.0.67 → 5.0.69
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 +19 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/dist/mantle/index.cjs +1 -1
- package/dist/mantle/index.js +1 -1
- package/package.json +5 -5
- package/src/amazon-bedrock-chat-language-model.ts +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @ai-sdk/amazon-bedrock
|
|
2
2
|
|
|
3
|
+
## 5.0.69
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [7439d7a]
|
|
8
|
+
- @ai-sdk/openai@4.0.53
|
|
9
|
+
|
|
10
|
+
## 5.0.68
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 051a41d: Enable Anthropic reasoning budgets for application inference profile ARNs.
|
|
15
|
+
- Updated dependencies [1c68540]
|
|
16
|
+
- Updated dependencies [aa45741]
|
|
17
|
+
- @ai-sdk/openai@4.0.52
|
|
18
|
+
- @ai-sdk/anthropic@4.0.46
|
|
19
|
+
- @ai-sdk/provider@4.0.9
|
|
20
|
+
- @ai-sdk/provider-utils@5.0.34
|
|
21
|
+
|
|
3
22
|
## 5.0.67
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/anthropic/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import { AwsV4Signer } from "aws4fetch";
|
|
25
25
|
|
|
26
26
|
// src/version.ts
|
|
27
|
-
var VERSION = true ? "5.0.
|
|
27
|
+
var VERSION = true ? "5.0.69" : "0.0.0-test";
|
|
28
28
|
|
|
29
29
|
// src/amazon-bedrock-sigv4-fetch.ts
|
|
30
30
|
function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
|
package/dist/index.js
CHANGED
|
@@ -1131,7 +1131,7 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1131
1131
|
reasoning,
|
|
1132
1132
|
providerOptions
|
|
1133
1133
|
}) {
|
|
1134
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
1134
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
1135
1135
|
let amazonBedrockOptions = (_b = (_a = await parseProviderOptions2({
|
|
1136
1136
|
provider: "amazonBedrock",
|
|
1137
1137
|
providerOptions,
|
|
@@ -1187,10 +1187,10 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1187
1187
|
details: "Only text and json response formats are supported."
|
|
1188
1188
|
});
|
|
1189
1189
|
}
|
|
1190
|
-
const isAnthropicModel = this.modelId.includes("anthropic");
|
|
1191
|
-
const openAIModelId = (
|
|
1190
|
+
const isAnthropicModel = this.modelId.includes("anthropic") || this.modelId.includes(":application-inference-profile/") && ((_c = amazonBedrockOptions.reasoningConfig) == null ? void 0 : _c.budgetTokens) != null;
|
|
1191
|
+
const openAIModelId = (_d = /^(?:[^.]+\.)?(openai\..+)$/.exec(this.modelId)) == null ? void 0 : _d[1];
|
|
1192
1192
|
const isOpenAIModel = openAIModelId != null;
|
|
1193
|
-
const isOpenAIGptOssModel = (
|
|
1193
|
+
const isOpenAIGptOssModel = (_e = openAIModelId == null ? void 0 : openAIModelId.startsWith("openai.gpt-oss-")) != null ? _e : false;
|
|
1194
1194
|
amazonBedrockOptions = resolveAmazonBedrockReasoningConfig({
|
|
1195
1195
|
reasoning,
|
|
1196
1196
|
amazonBedrockOptions,
|
|
@@ -1198,7 +1198,7 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1198
1198
|
isAnthropicModel,
|
|
1199
1199
|
modelId: this.modelId
|
|
1200
1200
|
});
|
|
1201
|
-
const isThinkingEnabled = ((
|
|
1201
|
+
const isThinkingEnabled = ((_f = amazonBedrockOptions.reasoningConfig) == null ? void 0 : _f.type) === "enabled" || ((_g = amazonBedrockOptions.reasoningConfig) == null ? void 0 : _g.type) === "adaptive";
|
|
1202
1202
|
const { supportsStructuredOutput: modelSupportsStructuredOutput } = getModelCapabilities(this.modelId);
|
|
1203
1203
|
const useNativeStructuredOutput = isAnthropicModel && supportsNativeStructuredOutput(this.modelId) && (modelSupportsStructuredOutput || isThinkingEnabled) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
|
|
1204
1204
|
const useJsonInstructionForStructuredOutput = isAnthropicModel && !supportsStrictTools(this.modelId) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && tools != null && tools.length > 0;
|
|
@@ -1222,16 +1222,16 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1222
1222
|
};
|
|
1223
1223
|
}
|
|
1224
1224
|
if (betas.size > 0 || amazonBedrockOptions.anthropicBeta) {
|
|
1225
|
-
const existingBetas = (
|
|
1225
|
+
const existingBetas = (_h = amazonBedrockOptions.anthropicBeta) != null ? _h : [];
|
|
1226
1226
|
const mergedBetas = betas.size > 0 ? [...existingBetas, ...Array.from(betas)] : existingBetas;
|
|
1227
1227
|
amazonBedrockOptions.additionalModelRequestFields = {
|
|
1228
1228
|
...amazonBedrockOptions.additionalModelRequestFields,
|
|
1229
1229
|
anthropic_beta: mergedBetas
|
|
1230
1230
|
};
|
|
1231
1231
|
}
|
|
1232
|
-
const thinkingType = (
|
|
1233
|
-
const thinkingBudget = thinkingType === "enabled" ? (
|
|
1234
|
-
const thinkingDisplay = thinkingType === "adaptive" ? (
|
|
1232
|
+
const thinkingType = (_i = amazonBedrockOptions.reasoningConfig) == null ? void 0 : _i.type;
|
|
1233
|
+
const thinkingBudget = thinkingType === "enabled" ? (_j = amazonBedrockOptions.reasoningConfig) == null ? void 0 : _j.budgetTokens : void 0;
|
|
1234
|
+
const thinkingDisplay = thinkingType === "adaptive" ? (_k = amazonBedrockOptions.reasoningConfig) == null ? void 0 : _k.display : void 0;
|
|
1235
1235
|
const isAnthropicThinkingEnabled = isAnthropicModel && isThinkingEnabled;
|
|
1236
1236
|
const inferenceConfig = {
|
|
1237
1237
|
...maxOutputTokens != null && { maxTokens: maxOutputTokens },
|
|
@@ -1264,7 +1264,7 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1264
1264
|
};
|
|
1265
1265
|
}
|
|
1266
1266
|
} else if (!isAnthropicModel) {
|
|
1267
|
-
if (((
|
|
1267
|
+
if (((_l = amazonBedrockOptions.reasoningConfig) == null ? void 0 : _l.budgetTokens) != null) {
|
|
1268
1268
|
warnings.push({
|
|
1269
1269
|
type: "unsupported",
|
|
1270
1270
|
feature: "budgetTokens",
|
|
@@ -1279,13 +1279,13 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1279
1279
|
});
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
|
-
const maxReasoningEffort = (
|
|
1282
|
+
const maxReasoningEffort = (_m = amazonBedrockOptions.reasoningConfig) == null ? void 0 : _m.maxReasoningEffort;
|
|
1283
1283
|
if (maxReasoningEffort != null) {
|
|
1284
1284
|
if (isAnthropicModel) {
|
|
1285
1285
|
amazonBedrockOptions.additionalModelRequestFields = {
|
|
1286
1286
|
...amazonBedrockOptions.additionalModelRequestFields,
|
|
1287
1287
|
output_config: {
|
|
1288
|
-
...(
|
|
1288
|
+
...(_n = amazonBedrockOptions.additionalModelRequestFields) == null ? void 0 : _n.output_config,
|
|
1289
1289
|
effort: maxReasoningEffort
|
|
1290
1290
|
}
|
|
1291
1291
|
};
|
|
@@ -1296,7 +1296,7 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1296
1296
|
} : {
|
|
1297
1297
|
...amazonBedrockOptions.additionalModelRequestFields,
|
|
1298
1298
|
reasoning: {
|
|
1299
|
-
...(
|
|
1299
|
+
...(_o = amazonBedrockOptions.additionalModelRequestFields) == null ? void 0 : _o.reasoning,
|
|
1300
1300
|
effort: maxReasoningEffort
|
|
1301
1301
|
}
|
|
1302
1302
|
};
|
|
@@ -1315,7 +1315,7 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1315
1315
|
amazonBedrockOptions.additionalModelRequestFields = {
|
|
1316
1316
|
...amazonBedrockOptions.additionalModelRequestFields,
|
|
1317
1317
|
output_config: {
|
|
1318
|
-
...(
|
|
1318
|
+
...(_p = amazonBedrockOptions.additionalModelRequestFields) == null ? void 0 : _p.output_config,
|
|
1319
1319
|
format: {
|
|
1320
1320
|
type: "json_schema",
|
|
1321
1321
|
schema: sanitizeJsonSchema(responseFormat.schema)
|
|
@@ -1347,7 +1347,7 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1347
1347
|
details: "topK is not supported when thinking is enabled"
|
|
1348
1348
|
});
|
|
1349
1349
|
}
|
|
1350
|
-
const hasAnyTools = ((
|
|
1350
|
+
const hasAnyTools = ((_r = (_q = toolConfig.tools) == null ? void 0 : _q.length) != null ? _r : 0) > 0 || additionalTools;
|
|
1351
1351
|
let filteredPrompt = prompt;
|
|
1352
1352
|
if (!hasAnyTools) {
|
|
1353
1353
|
const hasToolContent = prompt.some(
|
|
@@ -1390,7 +1390,7 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1390
1390
|
additionalModelRequestFields: __,
|
|
1391
1391
|
serviceTier: ___,
|
|
1392
1392
|
...filteredAmazonBedrockOptions
|
|
1393
|
-
} = (
|
|
1393
|
+
} = (_t = (_s = providerOptions == null ? void 0 : providerOptions.amazonBedrock) != null ? _s : providerOptions == null ? void 0 : providerOptions.bedrock) != null ? _t : {};
|
|
1394
1394
|
const additionalModelResponseFieldPaths = isAnthropicModel ? ["/delta/stop_sequence"] : void 0;
|
|
1395
1395
|
return {
|
|
1396
1396
|
command: {
|
|
@@ -2699,7 +2699,7 @@ import {
|
|
|
2699
2699
|
import { AwsV4Signer } from "aws4fetch";
|
|
2700
2700
|
|
|
2701
2701
|
// src/version.ts
|
|
2702
|
-
var VERSION = true ? "5.0.
|
|
2702
|
+
var VERSION = true ? "5.0.69" : "0.0.0-test";
|
|
2703
2703
|
|
|
2704
2704
|
// src/amazon-bedrock-sigv4-fetch.ts
|
|
2705
2705
|
function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
|