@ai-sdk/amazon-bedrock 5.0.92 → 5.0.93
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 +16 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/index.js +52 -11
- package/dist/index.js.map +1 -1
- package/dist/mantle/index.cjs +5 -4
- package/dist/mantle/index.cjs.map +1 -1
- package/dist/mantle/index.js +5 -4
- package/dist/mantle/index.js.map +1 -1
- package/docs/08-amazon-bedrock.mdx +4 -2
- package/package.json +4 -4
- package/src/amazon-bedrock-chat-language-model.ts +66 -11
- package/src/mantle/bedrock-mantle-provider.ts +9 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @ai-sdk/amazon-bedrock
|
|
2
2
|
|
|
3
|
+
## 5.0.93
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b7bc639: fix(amazon-bedrock): route supported Mantle models through the OpenAI endpoint
|
|
8
|
+
- 31fb009: fix(amazon-bedrock): omit unsupported sampling parameters for newer Claude models
|
|
9
|
+
- fbdda09: fix(amazon-bedrock): omit unsupported OpenAI sampling settings from Converse requests
|
|
10
|
+
- 771e74b: chore: enable dead code lint rules
|
|
11
|
+
- Updated dependencies [fe07867]
|
|
12
|
+
- Updated dependencies [a4b0940]
|
|
13
|
+
- Updated dependencies [4cf5a99]
|
|
14
|
+
- Updated dependencies [771e74b]
|
|
15
|
+
- @ai-sdk/provider-utils@5.0.47
|
|
16
|
+
- @ai-sdk/openai@4.0.74
|
|
17
|
+
- @ai-sdk/anthropic@4.0.62
|
|
18
|
+
|
|
3
19
|
## 5.0.92
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/anthropic/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import { AwsV4Signer } from "aws4fetch";
|
|
24
24
|
|
|
25
25
|
// src/version.ts
|
|
26
|
-
var VERSION = true ? "5.0.
|
|
26
|
+
var VERSION = true ? "5.0.93" : "0.0.0-test";
|
|
27
27
|
|
|
28
28
|
// src/amazon-bedrock-sigv4-fetch.ts
|
|
29
29
|
function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
|
package/dist/index.js
CHANGED
|
@@ -1264,6 +1264,11 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1264
1264
|
schema: anthropicProviderOptions
|
|
1265
1265
|
});
|
|
1266
1266
|
const warnings = [];
|
|
1267
|
+
const {
|
|
1268
|
+
supportsStructuredOutput: modelSupportsStructuredOutput,
|
|
1269
|
+
rejectsSamplingParameters,
|
|
1270
|
+
rejectsForcedToolUse
|
|
1271
|
+
} = getModelCapabilities(this.modelId);
|
|
1267
1272
|
if (frequencyPenalty != null) {
|
|
1268
1273
|
warnings.push({
|
|
1269
1274
|
type: "unsupported",
|
|
@@ -1282,14 +1287,44 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1282
1287
|
feature: "seed"
|
|
1283
1288
|
});
|
|
1284
1289
|
}
|
|
1285
|
-
if (
|
|
1290
|
+
if (rejectsSamplingParameters) {
|
|
1291
|
+
if (temperature != null) {
|
|
1292
|
+
warnings.push({
|
|
1293
|
+
type: "unsupported",
|
|
1294
|
+
feature: "temperature",
|
|
1295
|
+
details: `temperature is not supported by ${this.modelId} and will be ignored`
|
|
1296
|
+
});
|
|
1297
|
+
temperature = void 0;
|
|
1298
|
+
}
|
|
1299
|
+
if (topK != null) {
|
|
1300
|
+
warnings.push({
|
|
1301
|
+
type: "unsupported",
|
|
1302
|
+
feature: "topK",
|
|
1303
|
+
details: `topK is not supported by ${this.modelId} and will be ignored`
|
|
1304
|
+
});
|
|
1305
|
+
topK = void 0;
|
|
1306
|
+
}
|
|
1307
|
+
if (topP != null) {
|
|
1308
|
+
warnings.push({
|
|
1309
|
+
type: "unsupported",
|
|
1310
|
+
feature: "topP",
|
|
1311
|
+
details: `topP is not supported by ${this.modelId} and will be ignored`
|
|
1312
|
+
});
|
|
1313
|
+
topP = void 0;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
const openAIModelId = (_c = /^(?:[^.]+\.)?(openai\..+)$/.exec(this.modelId)) == null ? void 0 : _c[1];
|
|
1317
|
+
const isOpenAIModel = openAIModelId != null;
|
|
1318
|
+
const isOpenAIGptOssModel = (_d = openAIModelId == null ? void 0 : openAIModelId.startsWith("openai.gpt-oss-")) != null ? _d : false;
|
|
1319
|
+
const shouldNormalizeTemperature = !isOpenAIModel || isOpenAIGptOssModel;
|
|
1320
|
+
if (shouldNormalizeTemperature && temperature != null && temperature > 1) {
|
|
1286
1321
|
warnings.push({
|
|
1287
1322
|
type: "unsupported",
|
|
1288
1323
|
feature: "temperature",
|
|
1289
1324
|
details: `${temperature} exceeds bedrock maximum of 1.0. clamped to 1.0`
|
|
1290
1325
|
});
|
|
1291
1326
|
temperature = 1;
|
|
1292
|
-
} else if (temperature != null && temperature < 0) {
|
|
1327
|
+
} else if (shouldNormalizeTemperature && temperature != null && temperature < 0) {
|
|
1293
1328
|
warnings.push({
|
|
1294
1329
|
type: "unsupported",
|
|
1295
1330
|
feature: "temperature",
|
|
@@ -1307,11 +1342,8 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1307
1342
|
const isAnthropicModel2 = isAnthropicModel({
|
|
1308
1343
|
modelId: this.modelId,
|
|
1309
1344
|
modelFamily: this.config.modelFamily,
|
|
1310
|
-
reasoningBudgetTokens: (
|
|
1345
|
+
reasoningBudgetTokens: (_e = amazonBedrockOptions.reasoningConfig) == null ? void 0 : _e.budgetTokens
|
|
1311
1346
|
});
|
|
1312
|
-
const openAIModelId = (_d = /^(?:[^.]+\.)?(openai\..+)$/.exec(this.modelId)) == null ? void 0 : _d[1];
|
|
1313
|
-
const isOpenAIModel = openAIModelId != null;
|
|
1314
|
-
const isOpenAIGptOssModel = (_e = openAIModelId == null ? void 0 : openAIModelId.startsWith("openai.gpt-oss-")) != null ? _e : false;
|
|
1315
1347
|
amazonBedrockOptions = resolveAmazonBedrockReasoningConfig({
|
|
1316
1348
|
reasoning,
|
|
1317
1349
|
amazonBedrockOptions,
|
|
@@ -1320,10 +1352,6 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1320
1352
|
modelId: this.modelId
|
|
1321
1353
|
});
|
|
1322
1354
|
const isThinkingEnabled = ((_f = amazonBedrockOptions.reasoningConfig) == null ? void 0 : _f.type) === "enabled" || ((_g = amazonBedrockOptions.reasoningConfig) == null ? void 0 : _g.type) === "adaptive";
|
|
1323
|
-
const {
|
|
1324
|
-
supportsStructuredOutput: modelSupportsStructuredOutput,
|
|
1325
|
-
rejectsForcedToolUse
|
|
1326
|
-
} = getModelCapabilities(this.modelId);
|
|
1327
1355
|
const structuredOutputMode = (_i = (_h = amazonBedrockOptions.structuredOutputMode) != null ? _h : anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _i : "auto";
|
|
1328
1356
|
if (structuredOutputMode === "jsonTool") {
|
|
1329
1357
|
const additionalModelRequestFields = {
|
|
@@ -1494,6 +1522,19 @@ var AmazonBedrockChatLanguageModel = class _AmazonBedrockChatLanguageModel {
|
|
|
1494
1522
|
details: "topK is not supported when thinking is enabled"
|
|
1495
1523
|
});
|
|
1496
1524
|
}
|
|
1525
|
+
if (isOpenAIModel) {
|
|
1526
|
+
const unsupportedFeatures = isOpenAIGptOssModel ? ["stopSequences"] : ["temperature", "topP", "stopSequences"];
|
|
1527
|
+
for (const feature of unsupportedFeatures) {
|
|
1528
|
+
if (inferenceConfig[feature] != null) {
|
|
1529
|
+
delete inferenceConfig[feature];
|
|
1530
|
+
warnings.push({
|
|
1531
|
+
type: "unsupported",
|
|
1532
|
+
feature,
|
|
1533
|
+
details: `${feature} is not supported by this OpenAI model on the Converse API`
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1497
1538
|
const hasAnyTools = ((_u = (_t = toolConfig.tools) == null ? void 0 : _t.length) != null ? _u : 0) > 0 || additionalTools;
|
|
1498
1539
|
let filteredPrompt = prompt;
|
|
1499
1540
|
if (!hasAnyTools) {
|
|
@@ -2846,7 +2887,7 @@ import {
|
|
|
2846
2887
|
import { AwsV4Signer } from "aws4fetch";
|
|
2847
2888
|
|
|
2848
2889
|
// src/version.ts
|
|
2849
|
-
var VERSION = true ? "5.0.
|
|
2890
|
+
var VERSION = true ? "5.0.93" : "0.0.0-test";
|
|
2850
2891
|
|
|
2851
2892
|
// src/amazon-bedrock-sigv4-fetch.ts
|
|
2852
2893
|
function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
|