@ai-sdk/amazon-bedrock 5.0.0-beta.41 → 5.0.0-beta.42
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 +18 -0
- package/dist/anthropic/index.js +3 -3
- package/dist/anthropic/index.js.map +1 -1
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/anthropic/bedrock-anthropic-provider.ts +2 -2
- package/src/bedrock-chat-language-model.ts +18 -2
- package/src/convert-to-bedrock-chat-messages.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/amazon-bedrock",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.42",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"@smithy/eventstream-codec": "^4.0.1",
|
|
39
39
|
"@smithy/util-utf8": "^4.0.0",
|
|
40
40
|
"aws4fetch": "^1.0.20",
|
|
41
|
-
"@ai-sdk/anthropic": "4.0.0-beta.
|
|
41
|
+
"@ai-sdk/anthropic": "4.0.0-beta.38",
|
|
42
42
|
"@ai-sdk/provider": "4.0.0-beta.12",
|
|
43
|
-
"@ai-sdk/provider-utils": "5.0.0-beta.
|
|
43
|
+
"@ai-sdk/provider-utils": "5.0.0-beta.27"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "20.17.24",
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"node": ">=18"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
|
-
"access": "public"
|
|
60
|
+
"access": "public",
|
|
61
|
+
"provenance": true
|
|
61
62
|
},
|
|
62
63
|
"homepage": "https://ai-sdk.dev/docs",
|
|
63
64
|
"repository": {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from '@ai-sdk/provider-utils';
|
|
15
15
|
import {
|
|
16
16
|
anthropicTools,
|
|
17
|
-
|
|
17
|
+
AnthropicLanguageModel,
|
|
18
18
|
} from '@ai-sdk/anthropic/internal';
|
|
19
19
|
import {
|
|
20
20
|
BedrockCredentials,
|
|
@@ -249,7 +249,7 @@ export function createBedrockAnthropic(
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
const createChatModel = (modelId: BedrockAnthropicModelId) =>
|
|
252
|
-
new
|
|
252
|
+
new AnthropicLanguageModel(modelId, {
|
|
253
253
|
provider: 'bedrock.anthropic.messages',
|
|
254
254
|
baseURL: getBaseURL(),
|
|
255
255
|
headers: getHeaders,
|
|
@@ -1209,7 +1209,7 @@ function resolveBedrockReasoningConfig({
|
|
|
1209
1209
|
isAnthropicModel: boolean;
|
|
1210
1210
|
modelId: string;
|
|
1211
1211
|
}): AmazonBedrockLanguageModelOptions {
|
|
1212
|
-
if (!isCustomReasoning(reasoning)
|
|
1212
|
+
if (!isCustomReasoning(reasoning)) {
|
|
1213
1213
|
return bedrockOptions;
|
|
1214
1214
|
}
|
|
1215
1215
|
|
|
@@ -1229,6 +1229,7 @@ function resolveBedrockReasoningConfig({
|
|
|
1229
1229
|
result.reasoningConfig = {
|
|
1230
1230
|
type: 'adaptive',
|
|
1231
1231
|
maxReasoningEffort: effort,
|
|
1232
|
+
...bedrockOptions.reasoningConfig,
|
|
1232
1233
|
};
|
|
1233
1234
|
} else {
|
|
1234
1235
|
const budgetTokens = mapReasoningToProviderBudget({
|
|
@@ -1241,6 +1242,7 @@ function resolveBedrockReasoningConfig({
|
|
|
1241
1242
|
result.reasoningConfig = {
|
|
1242
1243
|
type: 'enabled',
|
|
1243
1244
|
budgetTokens,
|
|
1245
|
+
...bedrockOptions.reasoningConfig,
|
|
1244
1246
|
};
|
|
1245
1247
|
}
|
|
1246
1248
|
}
|
|
@@ -1250,7 +1252,21 @@ function resolveBedrockReasoningConfig({
|
|
|
1250
1252
|
effortMap: bedrockReasoningEffortMap,
|
|
1251
1253
|
warnings,
|
|
1252
1254
|
});
|
|
1253
|
-
result.reasoningConfig = {
|
|
1255
|
+
result.reasoningConfig = {
|
|
1256
|
+
maxReasoningEffort: effort,
|
|
1257
|
+
...bedrockOptions.reasoningConfig,
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
/*
|
|
1262
|
+
* Mirror anthropic-messages-language-model.ts: when the merged type ends up
|
|
1263
|
+
* 'disabled' (user override combined with a non-none reasoning), strip
|
|
1264
|
+
* derived effort/budget so downstream does not emit output_config.effort
|
|
1265
|
+
* alongside disabled thinking.
|
|
1266
|
+
*/
|
|
1267
|
+
if (result.reasoningConfig?.type === 'disabled') {
|
|
1268
|
+
delete result.reasoningConfig.maxReasoningEffort;
|
|
1269
|
+
delete result.reasoningConfig.budgetTokens;
|
|
1254
1270
|
}
|
|
1255
1271
|
|
|
1256
1272
|
return result;
|
|
@@ -213,7 +213,7 @@ export async function convertToBedrockChatMessages(
|
|
|
213
213
|
break;
|
|
214
214
|
case 'execution-denied':
|
|
215
215
|
toolResultContent = [
|
|
216
|
-
{ text: output.reason ?? 'Tool execution denied.' },
|
|
216
|
+
{ text: output.reason ?? 'Tool call execution denied.' },
|
|
217
217
|
];
|
|
218
218
|
break;
|
|
219
219
|
case 'json':
|