@ai-sdk/amazon-bedrock 4.0.40 → 4.0.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 +13 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -4
- package/dist/index.mjs.map +1 -1
- package/docs/08-amazon-bedrock.mdx +5 -2
- package/package.json +2 -2
- package/src/bedrock-embedding-model.ts +1 -0
- package/src/bedrock-embedding-options.ts +9 -1
|
@@ -539,6 +539,7 @@ const textEditorTool = bedrock.tools.textEditor_20250429({
|
|
|
539
539
|
file_text,
|
|
540
540
|
insert_line,
|
|
541
541
|
new_str,
|
|
542
|
+
insert_text,
|
|
542
543
|
old_str,
|
|
543
544
|
view_range,
|
|
544
545
|
}) => {
|
|
@@ -558,6 +559,7 @@ const textEditorTool = bedrock.tools.textEditor_20241022({
|
|
|
558
559
|
file_text,
|
|
559
560
|
insert_line,
|
|
560
561
|
new_str,
|
|
562
|
+
insert_text,
|
|
561
563
|
old_str,
|
|
562
564
|
view_range,
|
|
563
565
|
}) => {
|
|
@@ -573,7 +575,8 @@ Parameters:
|
|
|
573
575
|
- `path` (string): Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.
|
|
574
576
|
- `file_text` (string, optional): Required for `create` command, with the content of the file to be created.
|
|
575
577
|
- `insert_line` (number, optional): Required for `insert` command. The line number after which to insert the new string.
|
|
576
|
-
- `new_str` (string, optional): New string for `str_replace`
|
|
578
|
+
- `new_str` (string, optional): New string for `str_replace` command.
|
|
579
|
+
- `insert_text` (string, optional): Required for `insert` command, containing the text to insert.
|
|
577
580
|
- `old_str` (string, optional): Required for `str_replace` command, containing the string to replace.
|
|
578
581
|
- `view_range` (number[], optional): Optional for `view` command to specify line range to show.
|
|
579
582
|
|
|
@@ -1414,7 +1417,7 @@ const result = await generateText({
|
|
|
1414
1417
|
model: bedrockAnthropic('us.anthropic.claude-3-7-sonnet-20250219-v1:0'),
|
|
1415
1418
|
tools: {
|
|
1416
1419
|
str_replace_editor: bedrockAnthropic.tools.textEditor_20241022({
|
|
1417
|
-
execute: async ({ command, path, old_str, new_str }) => {
|
|
1420
|
+
execute: async ({ command, path, old_str, new_str, insert_text }) => {
|
|
1418
1421
|
// Implement your text editing logic here
|
|
1419
1422
|
return 'File updated successfully';
|
|
1420
1423
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/amazon-bedrock",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.42",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
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": "3.0.
|
|
41
|
+
"@ai-sdk/anthropic": "3.0.32",
|
|
42
42
|
"@ai-sdk/provider": "3.0.6",
|
|
43
43
|
"@ai-sdk/provider-utils": "4.0.11"
|
|
44
44
|
},
|
|
@@ -95,6 +95,7 @@ export class BedrockEmbeddingModel implements EmbeddingModelV3 {
|
|
|
95
95
|
input_type: bedrockOptions.inputType ?? 'search_query',
|
|
96
96
|
texts: [values[0]],
|
|
97
97
|
truncate: bedrockOptions.truncate,
|
|
98
|
+
output_dimension: bedrockOptions.outputDimension,
|
|
98
99
|
}
|
|
99
100
|
: {
|
|
100
101
|
inputText: values[0],
|
|
@@ -17,7 +17,7 @@ export const bedrockEmbeddingProviderOptions = z.object({
|
|
|
17
17
|
.optional(),
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Flag indicating whether or not to normalize the output embeddings. Defaults to true
|
|
20
|
+
* Flag indicating whether or not to normalize the output embeddings. Defaults to true.
|
|
21
21
|
* Only supported in amazon.titan-embed-text-v2:0.
|
|
22
22
|
*/
|
|
23
23
|
normalize: z.boolean().optional(),
|
|
@@ -63,4 +63,12 @@ export const bedrockEmbeddingProviderOptions = z.object({
|
|
|
63
63
|
* Supported in Cohere and Nova embedding models. Defaults to 'END' for Nova models.
|
|
64
64
|
*/
|
|
65
65
|
truncate: z.enum(['NONE', 'START', 'END']).optional(),
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The number of dimensions the resulting output embeddings should have (defaults to 1536).
|
|
69
|
+
* Only supported in cohere.embed-v4:0 and newer Cohere embedding models.
|
|
70
|
+
*/
|
|
71
|
+
outputDimension: z
|
|
72
|
+
.union([z.literal(256), z.literal(512), z.literal(1024), z.literal(1536)])
|
|
73
|
+
.optional(),
|
|
66
74
|
});
|