@ai-sdk/amazon-bedrock 4.0.86 → 4.0.88
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.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -2
- package/dist/index.mjs.map +1 -1
- package/docs/08-amazon-bedrock.mdx +31 -0
- package/package.json +2 -2
- package/src/bedrock-api-types.ts +3 -0
- package/src/bedrock-chat-language-model.ts +6 -0
- package/src/bedrock-chat-options.ts +10 -0
|
@@ -514,6 +514,37 @@ console.log(amazonResult.text); // text response
|
|
|
514
514
|
See [AI SDK UI: Chatbot](/docs/ai-sdk-ui/chatbot#reasoning) for more details
|
|
515
515
|
on how to integrate reasoning into your chatbot.
|
|
516
516
|
|
|
517
|
+
## Service Tiers
|
|
518
|
+
|
|
519
|
+
Amazon Bedrock supports selecting an inference service tier per request via the `serviceTier` provider option.
|
|
520
|
+
|
|
521
|
+
```ts
|
|
522
|
+
import {
|
|
523
|
+
bedrock,
|
|
524
|
+
type AmazonBedrockLanguageModelOptions,
|
|
525
|
+
} from '@ai-sdk/amazon-bedrock';
|
|
526
|
+
import { generateText } from 'ai';
|
|
527
|
+
|
|
528
|
+
const result = await generateText({
|
|
529
|
+
model: bedrock('us.anthropic.claude-sonnet-4-20250514-v1:0'),
|
|
530
|
+
prompt: 'Summarize this support ticket backlog.',
|
|
531
|
+
providerOptions: {
|
|
532
|
+
bedrock: {
|
|
533
|
+
serviceTier: 'priority',
|
|
534
|
+
} satisfies AmazonBedrockLanguageModelOptions,
|
|
535
|
+
},
|
|
536
|
+
});
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
Supported values are:
|
|
540
|
+
|
|
541
|
+
- `reserved`
|
|
542
|
+
- `priority`
|
|
543
|
+
- `default`
|
|
544
|
+
- `flex`
|
|
545
|
+
|
|
546
|
+
See the [Amazon Bedrock service tiers documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html) for model availability and behavior.
|
|
547
|
+
|
|
517
548
|
## Extended Context Window
|
|
518
549
|
|
|
519
550
|
Claude Sonnet 4 models on Amazon Bedrock support an extended context window of up to 1 million tokens when using the `context-1m-2025-08-07` beta feature.
|
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.88",
|
|
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.65",
|
|
42
42
|
"@ai-sdk/provider-utils": "4.0.21",
|
|
43
43
|
"@ai-sdk/provider": "3.0.8"
|
|
44
44
|
},
|
package/src/bedrock-api-types.ts
CHANGED
|
@@ -13,6 +13,9 @@ export interface BedrockConverseInput {
|
|
|
13
13
|
};
|
|
14
14
|
additionalModelRequestFields?: Record<string, unknown>;
|
|
15
15
|
additionalModelResponseFieldPaths?: string[];
|
|
16
|
+
serviceTier?: {
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
16
19
|
guardrailConfig?:
|
|
17
20
|
| BedrockGuardrailConfiguration
|
|
18
21
|
| BedrockGuardrailStreamConfiguration
|
|
@@ -368,6 +368,7 @@ export class BedrockChatLanguageModel implements LanguageModelV3 {
|
|
|
368
368
|
const {
|
|
369
369
|
reasoningConfig: _,
|
|
370
370
|
additionalModelRequestFields: __,
|
|
371
|
+
serviceTier: ___,
|
|
371
372
|
...filteredBedrockOptions
|
|
372
373
|
} = providerOptions?.bedrock || {};
|
|
373
374
|
|
|
@@ -387,6 +388,11 @@ export class BedrockChatLanguageModel implements LanguageModelV3 {
|
|
|
387
388
|
...(Object.keys(inferenceConfig).length > 0 && {
|
|
388
389
|
inferenceConfig,
|
|
389
390
|
}),
|
|
391
|
+
...(bedrockOptions.serviceTier != null && {
|
|
392
|
+
serviceTier: {
|
|
393
|
+
type: bedrockOptions.serviceTier,
|
|
394
|
+
},
|
|
395
|
+
}),
|
|
390
396
|
...filteredBedrockOptions,
|
|
391
397
|
...(toolConfig.tools !== undefined && toolConfig.tools.length > 0
|
|
392
398
|
? { toolConfig }
|
|
@@ -122,6 +122,16 @@ export const amazonBedrockLanguageModelOptions = z.object({
|
|
|
122
122
|
* Anthropic beta features to enable
|
|
123
123
|
*/
|
|
124
124
|
anthropicBeta: z.array(z.string()).optional(),
|
|
125
|
+
/**
|
|
126
|
+
* Service tier for the request.
|
|
127
|
+
* @see https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html
|
|
128
|
+
*
|
|
129
|
+
* - 'reserved': Uses provisioned throughput capacity
|
|
130
|
+
* - 'priority': Prioritizes low-latency inference when capacity is available
|
|
131
|
+
* - 'default': Standard on-demand tier
|
|
132
|
+
* - 'flex': Lower-cost tier for flexible latency workloads
|
|
133
|
+
*/
|
|
134
|
+
serviceTier: z.enum(['reserved', 'priority', 'default', 'flex']).optional(),
|
|
125
135
|
});
|
|
126
136
|
|
|
127
137
|
export type AmazonBedrockLanguageModelOptions = z.infer<
|