@ai-sdk/amazon-bedrock 5.0.0-beta.7 → 5.0.0-beta.85
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 +677 -4
- package/README.md +2 -0
- package/dist/anthropic/index.d.ts +10 -10
- package/dist/anthropic/index.js +151 -117
- package/dist/anthropic/index.js.map +1 -1
- package/dist/index.d.ts +36 -23
- package/dist/index.js +881 -604
- package/dist/index.js.map +1 -1
- package/dist/mantle/index.cjs +253 -0
- package/dist/mantle/index.cjs.map +1 -0
- package/dist/mantle/index.d.cts +99 -0
- package/dist/mantle/index.d.ts +99 -0
- package/dist/mantle/index.js +240 -0
- package/dist/mantle/index.js.map +1 -0
- package/docs/08-amazon-bedrock.mdx +310 -84
- package/mantle/index.d.ts +1 -0
- package/package.json +27 -20
- package/src/amazon-bedrock-api-types.ts +228 -0
- package/src/{bedrock-chat-options.ts → amazon-bedrock-chat-language-model-options.ts} +27 -8
- package/src/{bedrock-chat-language-model.ts → amazon-bedrock-chat-language-model.ts} +350 -180
- package/src/{bedrock-embedding-options.ts → amazon-bedrock-embedding-model-options.ts} +1 -1
- package/src/{bedrock-embedding-model.ts → amazon-bedrock-embedding-model.ts} +61 -29
- package/src/{bedrock-error.ts → amazon-bedrock-error.ts} +1 -1
- package/src/{bedrock-event-stream-decoder.ts → amazon-bedrock-event-stream-decoder.ts} +1 -1
- package/src/{bedrock-event-stream-response-handler.ts → amazon-bedrock-event-stream-response-handler.ts} +6 -6
- package/src/{bedrock-image-model.ts → amazon-bedrock-image-model.ts} +62 -38
- package/src/amazon-bedrock-image-settings.ts +9 -0
- package/src/{bedrock-prepare-tools.ts → amazon-bedrock-prepare-tools.ts} +22 -18
- package/src/{bedrock-provider.ts → amazon-bedrock-provider.ts} +53 -46
- package/src/amazon-bedrock-reasoning-metadata.ts +10 -0
- package/src/{bedrock-sigv4-fetch.ts → amazon-bedrock-sigv4-fetch.ts} +17 -9
- package/src/anthropic/amazon-bedrock-anthropic-fetch.ts +104 -0
- package/src/anthropic/{bedrock-anthropic-options.ts → amazon-bedrock-anthropic-options.ts} +7 -1
- package/src/anthropic/{bedrock-anthropic-provider.ts → amazon-bedrock-anthropic-provider.ts} +40 -24
- package/src/anthropic/index.ts +19 -7
- package/src/{convert-bedrock-usage.ts → convert-amazon-bedrock-usage.ts} +4 -4
- package/src/convert-to-amazon-bedrock-chat-messages.ts +556 -0
- package/src/index.ts +15 -8
- package/src/inject-fetch-headers.ts +1 -1
- package/src/mantle/bedrock-mantle-options.ts +15 -0
- package/src/mantle/bedrock-mantle-provider.ts +283 -0
- package/src/mantle/index.ts +6 -0
- package/src/{map-bedrock-finish-reason.ts → map-amazon-bedrock-finish-reason.ts} +4 -4
- package/src/reranking/{bedrock-reranking-api.ts → amazon-bedrock-reranking-api.ts} +3 -3
- package/src/reranking/{bedrock-reranking-options.ts → amazon-bedrock-reranking-model-options.ts} +1 -1
- package/src/reranking/{bedrock-reranking-model.ts → amazon-bedrock-reranking-model.ts} +32 -25
- package/dist/anthropic/index.d.mts +0 -91
- package/dist/anthropic/index.mjs +0 -397
- package/dist/anthropic/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -194
- package/dist/index.mjs +0 -2329
- package/dist/index.mjs.map +0 -1
- package/src/anthropic/bedrock-anthropic-fetch.ts +0 -68
- package/src/bedrock-api-types.ts +0 -216
- package/src/bedrock-image-settings.ts +0 -6
- package/src/convert-to-bedrock-chat-messages.ts +0 -468
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/mantle';
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/amazon-bedrock",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.85",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"license": "Apache-2.0",
|
|
5
6
|
"sideEffects": false,
|
|
6
7
|
"main": "./dist/index.js",
|
|
7
|
-
"module": "./dist/index.mjs",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/**/*",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"!src/**/__fixtures__",
|
|
17
17
|
"CHANGELOG.md",
|
|
18
18
|
"README.md",
|
|
19
|
-
"anthropic/index.d.ts"
|
|
19
|
+
"anthropic/index.d.ts",
|
|
20
|
+
"mantle/index.d.ts"
|
|
20
21
|
],
|
|
21
22
|
"directories": {
|
|
22
23
|
"doc": "./docs"
|
|
@@ -25,44 +26,52 @@
|
|
|
25
26
|
"./package.json": "./package.json",
|
|
26
27
|
".": {
|
|
27
28
|
"types": "./dist/index.d.ts",
|
|
28
|
-
"import": "./dist/index.
|
|
29
|
-
"
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"default": "./dist/index.js"
|
|
30
31
|
},
|
|
31
32
|
"./anthropic": {
|
|
32
33
|
"types": "./dist/anthropic/index.d.ts",
|
|
33
|
-
"import": "./dist/anthropic/index.
|
|
34
|
-
"
|
|
34
|
+
"import": "./dist/anthropic/index.js",
|
|
35
|
+
"default": "./dist/anthropic/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./mantle": {
|
|
38
|
+
"types": "./dist/mantle/index.d.ts",
|
|
39
|
+
"import": "./dist/mantle/index.js",
|
|
40
|
+
"require": "./dist/mantle/index.cjs"
|
|
35
41
|
}
|
|
36
42
|
},
|
|
37
43
|
"dependencies": {
|
|
38
|
-
"@smithy/eventstream-codec": "^4.
|
|
39
|
-
"@smithy/util-utf8": "^4.
|
|
44
|
+
"@smithy/eventstream-codec": "^4.3.3",
|
|
45
|
+
"@smithy/util-utf8": "^4.3.3",
|
|
40
46
|
"aws4fetch": "^1.0.20",
|
|
41
|
-
"@ai-sdk/anthropic": "4.0.0-beta.
|
|
42
|
-
"@ai-sdk/
|
|
43
|
-
"@ai-sdk/provider
|
|
47
|
+
"@ai-sdk/anthropic": "4.0.0-beta.67",
|
|
48
|
+
"@ai-sdk/openai": "4.0.0-beta.74",
|
|
49
|
+
"@ai-sdk/provider": "4.0.0-beta.19",
|
|
50
|
+
"@ai-sdk/provider-utils": "5.0.0-beta.49"
|
|
44
51
|
},
|
|
45
52
|
"devDependencies": {
|
|
46
|
-
"@types/node": "
|
|
47
|
-
"tsup": "^8.
|
|
53
|
+
"@types/node": "22.19.19",
|
|
54
|
+
"tsup": "^8.5.1",
|
|
48
55
|
"typescript": "5.8.3",
|
|
49
56
|
"zod": "3.25.76",
|
|
50
|
-
"@ai-sdk/test-server": "2.0.0-beta.
|
|
57
|
+
"@ai-sdk/test-server": "2.0.0-beta.7",
|
|
51
58
|
"@vercel/ai-tsconfig": "0.0.0"
|
|
52
59
|
},
|
|
53
60
|
"peerDependencies": {
|
|
54
61
|
"zod": "^3.25.76 || ^4.1.8"
|
|
55
62
|
},
|
|
56
63
|
"engines": {
|
|
57
|
-
"node": ">=
|
|
64
|
+
"node": ">=22"
|
|
58
65
|
},
|
|
59
66
|
"publishConfig": {
|
|
60
|
-
"access": "public"
|
|
67
|
+
"access": "public",
|
|
68
|
+
"provenance": true
|
|
61
69
|
},
|
|
62
70
|
"homepage": "https://ai-sdk.dev/docs",
|
|
63
71
|
"repository": {
|
|
64
72
|
"type": "git",
|
|
65
|
-
"url": "
|
|
73
|
+
"url": "https://github.com/vercel/ai",
|
|
74
|
+
"directory": "packages/amazon-bedrock"
|
|
66
75
|
},
|
|
67
76
|
"bugs": {
|
|
68
77
|
"url": "https://github.com/vercel/ai/issues"
|
|
@@ -74,9 +83,7 @@
|
|
|
74
83
|
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
|
|
75
84
|
"build:watch": "pnpm clean && tsup --watch",
|
|
76
85
|
"clean": "del-cli dist docs *.tsbuildinfo",
|
|
77
|
-
"lint": "eslint \"./**/*.ts*\"",
|
|
78
86
|
"type-check": "tsc --build",
|
|
79
|
-
"prettier-check": "prettier --check \"./**/*.ts*\"",
|
|
80
87
|
"test": "pnpm test:node && pnpm test:edge",
|
|
81
88
|
"test:update": "pnpm test:node -u",
|
|
82
89
|
"test:watch": "vitest --config vitest.node.config.js",
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import type { JSONObject } from '@ai-sdk/provider';
|
|
2
|
+
|
|
3
|
+
export interface AmazonBedrockConverseInput {
|
|
4
|
+
system?: AmazonBedrockSystemMessages;
|
|
5
|
+
messages: AmazonBedrockMessages;
|
|
6
|
+
toolConfig?: AmazonBedrockToolConfiguration;
|
|
7
|
+
inferenceConfig?: {
|
|
8
|
+
maxOutputTokens?: number;
|
|
9
|
+
temperature?: number;
|
|
10
|
+
topP?: number;
|
|
11
|
+
topK?: number;
|
|
12
|
+
stopSequences?: string[];
|
|
13
|
+
};
|
|
14
|
+
additionalModelRequestFields?: Record<string, unknown>;
|
|
15
|
+
additionalModelResponseFieldPaths?: string[];
|
|
16
|
+
serviceTier?: {
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
19
|
+
guardrailConfig?:
|
|
20
|
+
| AmazonBedrockGuardrailConfiguration
|
|
21
|
+
| AmazonBedrockGuardrailStreamConfiguration
|
|
22
|
+
| undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type AmazonBedrockSystemMessages =
|
|
26
|
+
Array<AmazonBedrockSystemContentBlock>;
|
|
27
|
+
|
|
28
|
+
export type AmazonBedrockMessages = Array<
|
|
29
|
+
AmazonBedrockAssistantMessage | AmazonBedrockUserMessage
|
|
30
|
+
>;
|
|
31
|
+
|
|
32
|
+
export interface AmazonBedrockAssistantMessage {
|
|
33
|
+
role: 'assistant';
|
|
34
|
+
content: Array<AmazonBedrockContentBlock>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface AmazonBedrockUserMessage {
|
|
38
|
+
role: 'user';
|
|
39
|
+
content: Array<AmazonBedrockContentBlock>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Cache TTL options for Bedrock prompt caching.
|
|
44
|
+
* @see https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html
|
|
45
|
+
*
|
|
46
|
+
* - '5m': 5-minute TTL (default, supported by all models)
|
|
47
|
+
* - '1h': 1-hour TTL (supported by Claude Opus 4.5, Claude Haiku 4.5, Claude Sonnet 4.5)
|
|
48
|
+
*/
|
|
49
|
+
export type AmazonBedrockCacheTTL = '5m' | '1h';
|
|
50
|
+
|
|
51
|
+
export type AmazonBedrockCachePoint = {
|
|
52
|
+
cachePoint: { type: 'default'; ttl?: AmazonBedrockCacheTTL };
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Creates a cache point with an optional TTL.
|
|
57
|
+
* @param ttl - Cache TTL ('5m' or '1h'). If not provided, uses the default 5-minute TTL.
|
|
58
|
+
*/
|
|
59
|
+
export function createAmazonBedrockCachePoint(
|
|
60
|
+
ttl?: AmazonBedrockCacheTTL,
|
|
61
|
+
): AmazonBedrockCachePoint {
|
|
62
|
+
return {
|
|
63
|
+
cachePoint: { type: 'default', ttl },
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type AmazonBedrockSystemContentBlock =
|
|
68
|
+
| { text: string }
|
|
69
|
+
| AmazonBedrockCachePoint;
|
|
70
|
+
|
|
71
|
+
export interface AmazonBedrockGuardrailConfiguration {
|
|
72
|
+
guardrails?: Array<{
|
|
73
|
+
name: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
parameters?: Record<string, unknown>;
|
|
76
|
+
}>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type AmazonBedrockGuardrailStreamConfiguration =
|
|
80
|
+
AmazonBedrockGuardrailConfiguration;
|
|
81
|
+
|
|
82
|
+
export interface AmazonBedrockToolInputSchema {
|
|
83
|
+
json: Record<string, unknown>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface AmazonBedrockTool {
|
|
87
|
+
toolSpec: {
|
|
88
|
+
name: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
strict?: boolean;
|
|
91
|
+
inputSchema: { json: JSONObject };
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface AmazonBedrockToolConfiguration {
|
|
96
|
+
tools?: Array<AmazonBedrockTool | AmazonBedrockCachePoint>;
|
|
97
|
+
toolChoice?:
|
|
98
|
+
| { tool: { name: string } }
|
|
99
|
+
| { auto: {} }
|
|
100
|
+
| { any: {} }
|
|
101
|
+
| undefined;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export const BEDROCK_STOP_REASONS = [
|
|
105
|
+
'stop',
|
|
106
|
+
'stop_sequence',
|
|
107
|
+
'end_turn',
|
|
108
|
+
'length',
|
|
109
|
+
'max_tokens',
|
|
110
|
+
'content-filter',
|
|
111
|
+
'content_filtered',
|
|
112
|
+
'guardrail_intervened',
|
|
113
|
+
'tool-calls',
|
|
114
|
+
'tool_use',
|
|
115
|
+
] as const;
|
|
116
|
+
|
|
117
|
+
export type AmazonBedrockStopReason = (typeof BEDROCK_STOP_REASONS)[number];
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @see https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ImageBlock.html
|
|
121
|
+
*/
|
|
122
|
+
export const BEDROCK_IMAGE_MIME_TYPES = {
|
|
123
|
+
'image/jpeg': 'jpeg',
|
|
124
|
+
'image/png': 'png',
|
|
125
|
+
'image/gif': 'gif',
|
|
126
|
+
'image/webp': 'webp',
|
|
127
|
+
} as const;
|
|
128
|
+
type AmazonBedrockImageFormats = typeof BEDROCK_IMAGE_MIME_TYPES;
|
|
129
|
+
export type AmazonBedrockImageFormat =
|
|
130
|
+
AmazonBedrockImageFormats[keyof AmazonBedrockImageFormats];
|
|
131
|
+
export type AmazonBedrockImageMimeType = keyof AmazonBedrockImageFormats;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @see https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_DocumentBlock.html
|
|
135
|
+
*/
|
|
136
|
+
export const BEDROCK_DOCUMENT_MIME_TYPES = {
|
|
137
|
+
'application/pdf': 'pdf',
|
|
138
|
+
'text/csv': 'csv',
|
|
139
|
+
'application/msword': 'doc',
|
|
140
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
141
|
+
'docx',
|
|
142
|
+
'application/vnd.ms-excel': 'xls',
|
|
143
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',
|
|
144
|
+
'text/html': 'html',
|
|
145
|
+
'text/plain': 'txt',
|
|
146
|
+
'text/markdown': 'md',
|
|
147
|
+
} as const;
|
|
148
|
+
type AmazonBedrockDocumentFormats = typeof BEDROCK_DOCUMENT_MIME_TYPES;
|
|
149
|
+
export type AmazonBedrockDocumentFormat =
|
|
150
|
+
AmazonBedrockDocumentFormats[keyof AmazonBedrockDocumentFormats];
|
|
151
|
+
export type AmazonBedrockDocumentMimeType = keyof AmazonBedrockDocumentFormats;
|
|
152
|
+
|
|
153
|
+
export interface AmazonBedrockDocumentBlock {
|
|
154
|
+
document: {
|
|
155
|
+
format: AmazonBedrockDocumentFormat;
|
|
156
|
+
name: string;
|
|
157
|
+
source: {
|
|
158
|
+
bytes: string;
|
|
159
|
+
};
|
|
160
|
+
citations?: {
|
|
161
|
+
enabled: boolean;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface AmazonBedrockGuardrailConverseContentBlock {
|
|
167
|
+
guardContent: unknown;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface AmazonBedrockImageBlock {
|
|
171
|
+
image: {
|
|
172
|
+
format: AmazonBedrockImageFormat;
|
|
173
|
+
source: {
|
|
174
|
+
bytes: string;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface AmazonBedrockToolResultBlock {
|
|
180
|
+
toolResult: {
|
|
181
|
+
toolUseId: string;
|
|
182
|
+
content: Array<
|
|
183
|
+
| AmazonBedrockTextBlock
|
|
184
|
+
| AmazonBedrockImageBlock
|
|
185
|
+
| AmazonBedrockDocumentBlock
|
|
186
|
+
>;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface AmazonBedrockToolUseBlock {
|
|
191
|
+
toolUse: {
|
|
192
|
+
toolUseId: string;
|
|
193
|
+
name: string;
|
|
194
|
+
input: Record<string, unknown>;
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface AmazonBedrockTextBlock {
|
|
199
|
+
text: string;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export interface AmazonBedrockReasoningContentBlock {
|
|
203
|
+
reasoningContent: {
|
|
204
|
+
reasoningText: {
|
|
205
|
+
text: string;
|
|
206
|
+
signature?: string;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface AmazonBedrockRedactedReasoningContentBlock {
|
|
212
|
+
reasoningContent: {
|
|
213
|
+
redactedReasoning: {
|
|
214
|
+
data: string;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export type AmazonBedrockContentBlock =
|
|
220
|
+
| AmazonBedrockDocumentBlock
|
|
221
|
+
| AmazonBedrockGuardrailConverseContentBlock
|
|
222
|
+
| AmazonBedrockImageBlock
|
|
223
|
+
| AmazonBedrockTextBlock
|
|
224
|
+
| AmazonBedrockToolResultBlock
|
|
225
|
+
| AmazonBedrockToolUseBlock
|
|
226
|
+
| AmazonBedrockReasoningContentBlock
|
|
227
|
+
| AmazonBedrockRedactedReasoningContentBlock
|
|
228
|
+
| AmazonBedrockCachePoint;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
2
|
|
|
3
3
|
// https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids.html
|
|
4
|
-
export type
|
|
4
|
+
export type AmazonBedrockChatModelId =
|
|
5
5
|
| 'amazon.titan-tg1-large'
|
|
6
6
|
| 'amazon.titan-text-express-v1'
|
|
7
7
|
| 'anthropic.claude-v2'
|
|
8
8
|
| 'anthropic.claude-v2:1'
|
|
9
9
|
| 'anthropic.claude-instant-v1'
|
|
10
|
+
| 'anthropic.claude-fable-5'
|
|
11
|
+
| 'anthropic.claude-opus-4-8'
|
|
12
|
+
| 'anthropic.claude-opus-4-7'
|
|
10
13
|
| 'anthropic.claude-opus-4-6-v1'
|
|
11
14
|
| 'anthropic.claude-sonnet-4-6-v1'
|
|
12
15
|
| 'anthropic.claude-opus-4-5-20251101-v1:0'
|
|
@@ -54,6 +57,9 @@ export type BedrockChatModelId =
|
|
|
54
57
|
| 'us.anthropic.claude-3-5-haiku-20241022-v1:0'
|
|
55
58
|
| 'us.anthropic.claude-3-5-sonnet-20241022-v2:0'
|
|
56
59
|
| 'us.anthropic.claude-3-7-sonnet-20250219-v1:0'
|
|
60
|
+
| 'us.anthropic.claude-fable-5'
|
|
61
|
+
| 'us.anthropic.claude-opus-4-8'
|
|
62
|
+
| 'us.anthropic.claude-opus-4-7'
|
|
57
63
|
| 'us.anthropic.claude-opus-4-6-v1'
|
|
58
64
|
| 'us.anthropic.claude-sonnet-4-6-v1'
|
|
59
65
|
| 'us.anthropic.claude-opus-4-5-20251101-v1:0'
|
|
@@ -79,7 +85,7 @@ export type BedrockChatModelId =
|
|
|
79
85
|
* Bedrock file part provider options for document-specific features.
|
|
80
86
|
* These options apply to individual file parts (documents).
|
|
81
87
|
*/
|
|
82
|
-
export const
|
|
88
|
+
export const amazonBedrockFilePartProviderOptions = z.object({
|
|
83
89
|
/**
|
|
84
90
|
* Citation configuration for this document.
|
|
85
91
|
* When enabled, this document will generate citations in the response.
|
|
@@ -94,11 +100,11 @@ export const bedrockFilePartProviderOptions = z.object({
|
|
|
94
100
|
.optional(),
|
|
95
101
|
});
|
|
96
102
|
|
|
97
|
-
export type
|
|
98
|
-
typeof
|
|
103
|
+
export type AmazonBedrockFilePartProviderOptions = z.infer<
|
|
104
|
+
typeof amazonBedrockFilePartProviderOptions
|
|
99
105
|
>;
|
|
100
106
|
|
|
101
|
-
export const
|
|
107
|
+
export const amazonBedrockLanguageModelChatOptions = z.object({
|
|
102
108
|
/**
|
|
103
109
|
* Additional inference parameters that the model supports,
|
|
104
110
|
* beyond the base set of inference parameters that Converse
|
|
@@ -115,15 +121,28 @@ export const amazonBedrockLanguageModelOptions = z.object({
|
|
|
115
121
|
])
|
|
116
122
|
.optional(),
|
|
117
123
|
budgetTokens: z.number().optional(),
|
|
118
|
-
maxReasoningEffort: z
|
|
124
|
+
maxReasoningEffort: z
|
|
125
|
+
.enum(['low', 'medium', 'high', 'xhigh', 'max'])
|
|
126
|
+
.optional(),
|
|
127
|
+
display: z.enum(['omitted', 'summarized']).optional(),
|
|
119
128
|
})
|
|
120
129
|
.optional(),
|
|
121
130
|
/**
|
|
122
131
|
* Anthropic beta features to enable
|
|
123
132
|
*/
|
|
124
133
|
anthropicBeta: z.array(z.string()).optional(),
|
|
134
|
+
/**
|
|
135
|
+
* Service tier for the request.
|
|
136
|
+
* @see https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html
|
|
137
|
+
*
|
|
138
|
+
* - 'reserved': Uses provisioned throughput capacity
|
|
139
|
+
* - 'priority': Prioritizes low-latency inference when capacity is available
|
|
140
|
+
* - 'default': Standard on-demand tier
|
|
141
|
+
* - 'flex': Lower-cost tier for flexible latency workloads
|
|
142
|
+
*/
|
|
143
|
+
serviceTier: z.enum(['reserved', 'priority', 'default', 'flex']).optional(),
|
|
125
144
|
});
|
|
126
145
|
|
|
127
|
-
export type
|
|
128
|
-
typeof
|
|
146
|
+
export type AmazonBedrockLanguageModelChatOptions = z.infer<
|
|
147
|
+
typeof amazonBedrockLanguageModelChatOptions
|
|
129
148
|
>;
|