@ai-sdk/amazon-bedrock 3.1.0-beta.8 → 4.0.0-beta.17
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 +77 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +52 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,82 @@
|
|
|
1
1
|
# @ai-sdk/amazon-bedrock
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.17
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- dee8b05: ai SDK 6 beta
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [dee8b05]
|
|
12
|
+
- @ai-sdk/anthropic@3.0.0-beta.14
|
|
13
|
+
- @ai-sdk/provider@3.0.0-beta.6
|
|
14
|
+
- @ai-sdk/provider-utils@4.0.0-beta.10
|
|
15
|
+
|
|
16
|
+
## 3.1.0-beta.16
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [521c537]
|
|
21
|
+
- @ai-sdk/provider-utils@3.1.0-beta.9
|
|
22
|
+
- @ai-sdk/anthropic@2.1.0-beta.13
|
|
23
|
+
|
|
24
|
+
## 3.1.0-beta.15
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [e06565c]
|
|
29
|
+
- @ai-sdk/provider-utils@3.1.0-beta.8
|
|
30
|
+
- @ai-sdk/anthropic@2.1.0-beta.12
|
|
31
|
+
|
|
32
|
+
## 3.1.0-beta.14
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- 11eefa4: Support user provided filenames in amazon-bedrock-provider
|
|
37
|
+
|
|
38
|
+
## 3.1.0-beta.13
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- e8109d3: feat: tool execution approval
|
|
43
|
+
- Updated dependencies [046aa3b]
|
|
44
|
+
- Updated dependencies [e8109d3]
|
|
45
|
+
- @ai-sdk/provider@2.1.0-beta.5
|
|
46
|
+
- @ai-sdk/provider-utils@3.1.0-beta.7
|
|
47
|
+
- @ai-sdk/anthropic@2.1.0-beta.11
|
|
48
|
+
|
|
49
|
+
## 3.1.0-beta.12
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Updated dependencies [dedf206]
|
|
54
|
+
- @ai-sdk/anthropic@2.1.0-beta.10
|
|
55
|
+
|
|
56
|
+
## 3.1.0-beta.11
|
|
57
|
+
|
|
58
|
+
### Patch Changes
|
|
59
|
+
|
|
60
|
+
- 0adc679: feat(provider): shared spec v3
|
|
61
|
+
- Updated dependencies [0adc679]
|
|
62
|
+
- Updated dependencies [2b0caef]
|
|
63
|
+
- @ai-sdk/provider-utils@3.1.0-beta.6
|
|
64
|
+
- @ai-sdk/anthropic@2.1.0-beta.9
|
|
65
|
+
- @ai-sdk/provider@2.1.0-beta.4
|
|
66
|
+
|
|
67
|
+
## 3.1.0-beta.10
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- c5e2a7c: Support citations in amazon-bedrock-provider
|
|
72
|
+
- 3aeb791: Add Claude Sonnet 4.5 (claude-sonnet-4-5-20250929-v1:0) model support
|
|
73
|
+
|
|
74
|
+
## 3.1.0-beta.9
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- d4b2964: fix(provider/amazon-bedrock): normalise headers and body if input is of instance Request
|
|
79
|
+
|
|
3
80
|
## 3.1.0-beta.8
|
|
4
81
|
|
|
5
82
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
|
3
3
|
import { anthropicTools } from '@ai-sdk/anthropic/internal';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
6
|
-
type BedrockChatModelId = 'amazon.titan-tg1-large' | 'amazon.titan-text-express-v1' | 'anthropic.claude-v2' | 'anthropic.claude-v2:1' | 'anthropic.claude-instant-v1' | 'anthropic.claude-sonnet-4-20250514-v1:0' | 'anthropic.claude-opus-4-20250514-v1:0' | 'anthropic.claude-opus-4-1-20250805-v1:0' | 'anthropic.claude-3-7-sonnet-20250219-v1:0' | 'anthropic.claude-3-5-sonnet-20240620-v1:0' | 'anthropic.claude-3-5-sonnet-20241022-v2:0' | 'anthropic.claude-3-5-haiku-20241022-v1:0' | 'anthropic.claude-3-sonnet-20240229-v1:0' | 'anthropic.claude-3-haiku-20240307-v1:0' | 'anthropic.claude-3-opus-20240229-v1:0' | 'cohere.command-text-v14' | 'cohere.command-light-text-v14' | 'cohere.command-r-v1:0' | 'cohere.command-r-plus-v1:0' | 'meta.llama3-70b-instruct-v1:0' | 'meta.llama3-8b-instruct-v1:0' | 'meta.llama3-1-405b-instruct-v1:0' | 'meta.llama3-1-70b-instruct-v1:0' | 'meta.llama3-1-8b-instruct-v1:0' | 'meta.llama3-2-11b-instruct-v1:0' | 'meta.llama3-2-1b-instruct-v1:0' | 'meta.llama3-2-3b-instruct-v1:0' | 'meta.llama3-2-90b-instruct-v1:0' | 'mistral.mistral-7b-instruct-v0:2' | 'mistral.mixtral-8x7b-instruct-v0:1' | 'mistral.mistral-large-2402-v1:0' | 'mistral.mistral-small-2402-v1:0' | 'openai.gpt-oss-120b-1:0' | 'openai.gpt-oss-20b-1:0' | 'amazon.titan-text-express-v1' | 'amazon.titan-text-lite-v1' | 'us.amazon.nova-premier-v1:0' | 'us.amazon.nova-pro-v1:0' | 'us.amazon.nova-micro-v1:0' | 'us.amazon.nova-lite-v1:0' | 'us.anthropic.claude-3-sonnet-20240229-v1:0' | 'us.anthropic.claude-3-opus-20240229-v1:0' | 'us.anthropic.claude-3-haiku-20240307-v1:0' | 'us.anthropic.claude-3-5-sonnet-20240620-v1:0' | 'us.anthropic.claude-3-5-haiku-20241022-v1:0' | 'us.anthropic.claude-3-5-sonnet-20241022-v2:0' | 'us.anthropic.claude-3-7-sonnet-20250219-v1:0' | 'us.anthropic.claude-sonnet-4-20250514-v1:0' | 'us.anthropic.claude-opus-4-20250514-v1:0' | 'us.anthropic.claude-opus-4-1-20250805-v1:0' | 'us.meta.llama3-2-11b-instruct-v1:0' | 'us.meta.llama3-2-3b-instruct-v1:0' | 'us.meta.llama3-2-90b-instruct-v1:0' | 'us.meta.llama3-2-1b-instruct-v1:0' | 'us.meta.llama3-1-8b-instruct-v1:0' | 'us.meta.llama3-1-70b-instruct-v1:0' | 'us.meta.llama3-3-70b-instruct-v1:0' | 'us.deepseek.r1-v1:0' | 'us.mistral.pixtral-large-2502-v1:0' | 'us.meta.llama4-scout-17b-instruct-v1:0' | 'us.meta.llama4-maverick-17b-instruct-v1:0' | (string & {});
|
|
6
|
+
type BedrockChatModelId = 'amazon.titan-tg1-large' | 'amazon.titan-text-express-v1' | 'anthropic.claude-v2' | 'anthropic.claude-v2:1' | 'anthropic.claude-instant-v1' | 'anthropic.claude-sonnet-4-20250514-v1:0' | 'anthropic.claude-sonnet-4-5-20250929-v1:0' | 'anthropic.claude-opus-4-20250514-v1:0' | 'anthropic.claude-opus-4-1-20250805-v1:0' | 'anthropic.claude-3-7-sonnet-20250219-v1:0' | 'anthropic.claude-3-5-sonnet-20240620-v1:0' | 'anthropic.claude-3-5-sonnet-20241022-v2:0' | 'anthropic.claude-3-5-haiku-20241022-v1:0' | 'anthropic.claude-3-sonnet-20240229-v1:0' | 'anthropic.claude-3-haiku-20240307-v1:0' | 'anthropic.claude-3-opus-20240229-v1:0' | 'cohere.command-text-v14' | 'cohere.command-light-text-v14' | 'cohere.command-r-v1:0' | 'cohere.command-r-plus-v1:0' | 'meta.llama3-70b-instruct-v1:0' | 'meta.llama3-8b-instruct-v1:0' | 'meta.llama3-1-405b-instruct-v1:0' | 'meta.llama3-1-70b-instruct-v1:0' | 'meta.llama3-1-8b-instruct-v1:0' | 'meta.llama3-2-11b-instruct-v1:0' | 'meta.llama3-2-1b-instruct-v1:0' | 'meta.llama3-2-3b-instruct-v1:0' | 'meta.llama3-2-90b-instruct-v1:0' | 'mistral.mistral-7b-instruct-v0:2' | 'mistral.mixtral-8x7b-instruct-v0:1' | 'mistral.mistral-large-2402-v1:0' | 'mistral.mistral-small-2402-v1:0' | 'openai.gpt-oss-120b-1:0' | 'openai.gpt-oss-20b-1:0' | 'amazon.titan-text-express-v1' | 'amazon.titan-text-lite-v1' | 'us.amazon.nova-premier-v1:0' | 'us.amazon.nova-pro-v1:0' | 'us.amazon.nova-micro-v1:0' | 'us.amazon.nova-lite-v1:0' | 'us.anthropic.claude-3-sonnet-20240229-v1:0' | 'us.anthropic.claude-3-opus-20240229-v1:0' | 'us.anthropic.claude-3-haiku-20240307-v1:0' | 'us.anthropic.claude-3-5-sonnet-20240620-v1:0' | 'us.anthropic.claude-3-5-haiku-20241022-v1:0' | 'us.anthropic.claude-3-5-sonnet-20241022-v2:0' | 'us.anthropic.claude-3-7-sonnet-20250219-v1:0' | 'us.anthropic.claude-sonnet-4-20250514-v1:0' | 'us.anthropic.claude-sonnet-4-5-20250929-v1:0' | 'us.anthropic.claude-opus-4-20250514-v1:0' | 'us.anthropic.claude-opus-4-1-20250805-v1:0' | 'us.meta.llama3-2-11b-instruct-v1:0' | 'us.meta.llama3-2-3b-instruct-v1:0' | 'us.meta.llama3-2-90b-instruct-v1:0' | 'us.meta.llama3-2-1b-instruct-v1:0' | 'us.meta.llama3-1-8b-instruct-v1:0' | 'us.meta.llama3-1-70b-instruct-v1:0' | 'us.meta.llama3-3-70b-instruct-v1:0' | 'us.deepseek.r1-v1:0' | 'us.mistral.pixtral-large-2502-v1:0' | 'us.meta.llama4-scout-17b-instruct-v1:0' | 'us.meta.llama4-maverick-17b-instruct-v1:0' | (string & {});
|
|
7
7
|
declare const bedrockProviderOptions: z.ZodObject<{
|
|
8
8
|
additionalModelRequestFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
9
9
|
reasoningConfig: z.ZodOptional<z.ZodObject<{
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
|
3
3
|
import { anthropicTools } from '@ai-sdk/anthropic/internal';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
6
|
-
type BedrockChatModelId = 'amazon.titan-tg1-large' | 'amazon.titan-text-express-v1' | 'anthropic.claude-v2' | 'anthropic.claude-v2:1' | 'anthropic.claude-instant-v1' | 'anthropic.claude-sonnet-4-20250514-v1:0' | 'anthropic.claude-opus-4-20250514-v1:0' | 'anthropic.claude-opus-4-1-20250805-v1:0' | 'anthropic.claude-3-7-sonnet-20250219-v1:0' | 'anthropic.claude-3-5-sonnet-20240620-v1:0' | 'anthropic.claude-3-5-sonnet-20241022-v2:0' | 'anthropic.claude-3-5-haiku-20241022-v1:0' | 'anthropic.claude-3-sonnet-20240229-v1:0' | 'anthropic.claude-3-haiku-20240307-v1:0' | 'anthropic.claude-3-opus-20240229-v1:0' | 'cohere.command-text-v14' | 'cohere.command-light-text-v14' | 'cohere.command-r-v1:0' | 'cohere.command-r-plus-v1:0' | 'meta.llama3-70b-instruct-v1:0' | 'meta.llama3-8b-instruct-v1:0' | 'meta.llama3-1-405b-instruct-v1:0' | 'meta.llama3-1-70b-instruct-v1:0' | 'meta.llama3-1-8b-instruct-v1:0' | 'meta.llama3-2-11b-instruct-v1:0' | 'meta.llama3-2-1b-instruct-v1:0' | 'meta.llama3-2-3b-instruct-v1:0' | 'meta.llama3-2-90b-instruct-v1:0' | 'mistral.mistral-7b-instruct-v0:2' | 'mistral.mixtral-8x7b-instruct-v0:1' | 'mistral.mistral-large-2402-v1:0' | 'mistral.mistral-small-2402-v1:0' | 'openai.gpt-oss-120b-1:0' | 'openai.gpt-oss-20b-1:0' | 'amazon.titan-text-express-v1' | 'amazon.titan-text-lite-v1' | 'us.amazon.nova-premier-v1:0' | 'us.amazon.nova-pro-v1:0' | 'us.amazon.nova-micro-v1:0' | 'us.amazon.nova-lite-v1:0' | 'us.anthropic.claude-3-sonnet-20240229-v1:0' | 'us.anthropic.claude-3-opus-20240229-v1:0' | 'us.anthropic.claude-3-haiku-20240307-v1:0' | 'us.anthropic.claude-3-5-sonnet-20240620-v1:0' | 'us.anthropic.claude-3-5-haiku-20241022-v1:0' | 'us.anthropic.claude-3-5-sonnet-20241022-v2:0' | 'us.anthropic.claude-3-7-sonnet-20250219-v1:0' | 'us.anthropic.claude-sonnet-4-20250514-v1:0' | 'us.anthropic.claude-opus-4-20250514-v1:0' | 'us.anthropic.claude-opus-4-1-20250805-v1:0' | 'us.meta.llama3-2-11b-instruct-v1:0' | 'us.meta.llama3-2-3b-instruct-v1:0' | 'us.meta.llama3-2-90b-instruct-v1:0' | 'us.meta.llama3-2-1b-instruct-v1:0' | 'us.meta.llama3-1-8b-instruct-v1:0' | 'us.meta.llama3-1-70b-instruct-v1:0' | 'us.meta.llama3-3-70b-instruct-v1:0' | 'us.deepseek.r1-v1:0' | 'us.mistral.pixtral-large-2502-v1:0' | 'us.meta.llama4-scout-17b-instruct-v1:0' | 'us.meta.llama4-maverick-17b-instruct-v1:0' | (string & {});
|
|
6
|
+
type BedrockChatModelId = 'amazon.titan-tg1-large' | 'amazon.titan-text-express-v1' | 'anthropic.claude-v2' | 'anthropic.claude-v2:1' | 'anthropic.claude-instant-v1' | 'anthropic.claude-sonnet-4-20250514-v1:0' | 'anthropic.claude-sonnet-4-5-20250929-v1:0' | 'anthropic.claude-opus-4-20250514-v1:0' | 'anthropic.claude-opus-4-1-20250805-v1:0' | 'anthropic.claude-3-7-sonnet-20250219-v1:0' | 'anthropic.claude-3-5-sonnet-20240620-v1:0' | 'anthropic.claude-3-5-sonnet-20241022-v2:0' | 'anthropic.claude-3-5-haiku-20241022-v1:0' | 'anthropic.claude-3-sonnet-20240229-v1:0' | 'anthropic.claude-3-haiku-20240307-v1:0' | 'anthropic.claude-3-opus-20240229-v1:0' | 'cohere.command-text-v14' | 'cohere.command-light-text-v14' | 'cohere.command-r-v1:0' | 'cohere.command-r-plus-v1:0' | 'meta.llama3-70b-instruct-v1:0' | 'meta.llama3-8b-instruct-v1:0' | 'meta.llama3-1-405b-instruct-v1:0' | 'meta.llama3-1-70b-instruct-v1:0' | 'meta.llama3-1-8b-instruct-v1:0' | 'meta.llama3-2-11b-instruct-v1:0' | 'meta.llama3-2-1b-instruct-v1:0' | 'meta.llama3-2-3b-instruct-v1:0' | 'meta.llama3-2-90b-instruct-v1:0' | 'mistral.mistral-7b-instruct-v0:2' | 'mistral.mixtral-8x7b-instruct-v0:1' | 'mistral.mistral-large-2402-v1:0' | 'mistral.mistral-small-2402-v1:0' | 'openai.gpt-oss-120b-1:0' | 'openai.gpt-oss-20b-1:0' | 'amazon.titan-text-express-v1' | 'amazon.titan-text-lite-v1' | 'us.amazon.nova-premier-v1:0' | 'us.amazon.nova-pro-v1:0' | 'us.amazon.nova-micro-v1:0' | 'us.amazon.nova-lite-v1:0' | 'us.anthropic.claude-3-sonnet-20240229-v1:0' | 'us.anthropic.claude-3-opus-20240229-v1:0' | 'us.anthropic.claude-3-haiku-20240307-v1:0' | 'us.anthropic.claude-3-5-sonnet-20240620-v1:0' | 'us.anthropic.claude-3-5-haiku-20241022-v1:0' | 'us.anthropic.claude-3-5-sonnet-20241022-v2:0' | 'us.anthropic.claude-3-7-sonnet-20250219-v1:0' | 'us.anthropic.claude-sonnet-4-20250514-v1:0' | 'us.anthropic.claude-sonnet-4-5-20250929-v1:0' | 'us.anthropic.claude-opus-4-20250514-v1:0' | 'us.anthropic.claude-opus-4-1-20250805-v1:0' | 'us.meta.llama3-2-11b-instruct-v1:0' | 'us.meta.llama3-2-3b-instruct-v1:0' | 'us.meta.llama3-2-90b-instruct-v1:0' | 'us.meta.llama3-2-1b-instruct-v1:0' | 'us.meta.llama3-1-8b-instruct-v1:0' | 'us.meta.llama3-1-70b-instruct-v1:0' | 'us.meta.llama3-3-70b-instruct-v1:0' | 'us.deepseek.r1-v1:0' | 'us.mistral.pixtral-large-2502-v1:0' | 'us.meta.llama4-scout-17b-instruct-v1:0' | 'us.meta.llama4-maverick-17b-instruct-v1:0' | (string & {});
|
|
7
7
|
declare const bedrockProviderOptions: z.ZodObject<{
|
|
8
8
|
additionalModelRequestFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
9
9
|
reasoningConfig: z.ZodOptional<z.ZodObject<{
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
30
30
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "
|
|
33
|
+
var VERSION = true ? "4.0.0-beta.17" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/bedrock-provider.ts
|
|
36
36
|
var import_internal2 = require("@ai-sdk/anthropic/internal");
|
|
@@ -75,6 +75,18 @@ var BEDROCK_DOCUMENT_MIME_TYPES = {
|
|
|
75
75
|
|
|
76
76
|
// src/bedrock-chat-options.ts
|
|
77
77
|
var import_v4 = require("zod/v4");
|
|
78
|
+
var bedrockFilePartProviderOptions = import_v4.z.object({
|
|
79
|
+
/**
|
|
80
|
+
* Citation configuration for this document.
|
|
81
|
+
* When enabled, this document will generate citations in the response.
|
|
82
|
+
*/
|
|
83
|
+
citations: import_v4.z.object({
|
|
84
|
+
/**
|
|
85
|
+
* Enable citations for this document
|
|
86
|
+
*/
|
|
87
|
+
enabled: import_v4.z.boolean()
|
|
88
|
+
}).optional()
|
|
89
|
+
});
|
|
78
90
|
var bedrockProviderOptions = import_v4.z.object({
|
|
79
91
|
/**
|
|
80
92
|
* Additional inference parameters that the model supports,
|
|
@@ -311,7 +323,17 @@ function getCachePoint(providerMetadata) {
|
|
|
311
323
|
var _a;
|
|
312
324
|
return (_a = providerMetadata == null ? void 0 : providerMetadata.bedrock) == null ? void 0 : _a.cachePoint;
|
|
313
325
|
}
|
|
326
|
+
async function shouldEnableCitations(providerMetadata) {
|
|
327
|
+
var _a, _b;
|
|
328
|
+
const bedrockOptions = await (0, import_provider_utils3.parseProviderOptions)({
|
|
329
|
+
provider: "bedrock",
|
|
330
|
+
providerOptions: providerMetadata,
|
|
331
|
+
schema: bedrockFilePartProviderOptions
|
|
332
|
+
});
|
|
333
|
+
return (_b = (_a = bedrockOptions == null ? void 0 : bedrockOptions.citations) == null ? void 0 : _a.enabled) != null ? _b : false;
|
|
334
|
+
}
|
|
314
335
|
async function convertToBedrockChatMessages(prompt) {
|
|
336
|
+
var _a, _b;
|
|
315
337
|
const blocks = groupIntoBlocks(prompt);
|
|
316
338
|
let system = [];
|
|
317
339
|
const messages = [];
|
|
@@ -371,11 +393,17 @@ async function convertToBedrockChatMessages(prompt) {
|
|
|
371
393
|
message: "File mime type is required in user message part content"
|
|
372
394
|
});
|
|
373
395
|
}
|
|
396
|
+
const enableCitations = await shouldEnableCitations(
|
|
397
|
+
part.providerOptions
|
|
398
|
+
);
|
|
374
399
|
bedrockContent.push({
|
|
375
400
|
document: {
|
|
376
401
|
format: getBedrockDocumentFormat(part.mediaType),
|
|
377
|
-
name: generateDocumentName(),
|
|
378
|
-
source: { bytes: (0, import_provider_utils3.convertToBase64)(part.data) }
|
|
402
|
+
name: (_a = part.filename) != null ? _a : generateDocumentName(),
|
|
403
|
+
source: { bytes: (0, import_provider_utils3.convertToBase64)(part.data) },
|
|
404
|
+
...enableCitations && {
|
|
405
|
+
citations: { enabled: true }
|
|
406
|
+
}
|
|
379
407
|
}
|
|
380
408
|
});
|
|
381
409
|
}
|
|
@@ -418,6 +446,11 @@ async function convertToBedrockChatMessages(prompt) {
|
|
|
418
446
|
case "error-text":
|
|
419
447
|
toolResultContent = [{ text: output.value }];
|
|
420
448
|
break;
|
|
449
|
+
case "execution-denied":
|
|
450
|
+
toolResultContent = [
|
|
451
|
+
{ text: (_b = output.reason) != null ? _b : "Tool execution denied." }
|
|
452
|
+
];
|
|
453
|
+
break;
|
|
421
454
|
case "json":
|
|
422
455
|
case "error-json":
|
|
423
456
|
default:
|
|
@@ -1495,21 +1528,33 @@ var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
|
1495
1528
|
var import_aws4fetch = require("aws4fetch");
|
|
1496
1529
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
|
1497
1530
|
return async (input, init) => {
|
|
1498
|
-
var _a;
|
|
1499
|
-
const
|
|
1531
|
+
var _a, _b;
|
|
1532
|
+
const request = input instanceof Request ? input : void 0;
|
|
1533
|
+
const originalHeaders = (0, import_provider_utils7.combineHeaders)(
|
|
1534
|
+
extractHeaders(request == null ? void 0 : request.headers),
|
|
1535
|
+
extractHeaders(init == null ? void 0 : init.headers)
|
|
1536
|
+
);
|
|
1500
1537
|
const headersWithUserAgent = (0, import_provider_utils7.withUserAgentSuffix)(
|
|
1501
1538
|
originalHeaders,
|
|
1502
1539
|
`ai-sdk/amazon-bedrock/${VERSION}`,
|
|
1503
1540
|
(0, import_provider_utils7.getRuntimeEnvironmentUserAgent)()
|
|
1504
1541
|
);
|
|
1505
|
-
|
|
1542
|
+
let effectiveBody = (_a = init == null ? void 0 : init.body) != null ? _a : void 0;
|
|
1543
|
+
if (effectiveBody === void 0 && request && request.body !== null) {
|
|
1544
|
+
try {
|
|
1545
|
+
effectiveBody = await request.clone().text();
|
|
1546
|
+
} catch (e) {
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
const effectiveMethod = (_b = init == null ? void 0 : init.method) != null ? _b : request == null ? void 0 : request.method;
|
|
1550
|
+
if ((effectiveMethod == null ? void 0 : effectiveMethod.toUpperCase()) !== "POST" || !effectiveBody) {
|
|
1506
1551
|
return fetch(input, {
|
|
1507
1552
|
...init,
|
|
1508
1553
|
headers: headersWithUserAgent
|
|
1509
1554
|
});
|
|
1510
1555
|
}
|
|
1511
1556
|
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
|
1512
|
-
const body = prepareBodyString(
|
|
1557
|
+
const body = prepareBodyString(effectiveBody);
|
|
1513
1558
|
const credentials = await getCredentials();
|
|
1514
1559
|
const signer = new import_aws4fetch.AwsV4Signer({
|
|
1515
1560
|
url,
|