@ai-sdk/amazon-bedrock 5.0.122 → 5.0.124
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 +23 -0
- package/README.md +3 -90
- package/dist/anthropic/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mantle/index.cjs +1 -1
- package/dist/mantle/index.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @ai-sdk/amazon-bedrock
|
|
2
2
|
|
|
3
|
+
## 5.0.124
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e729d58: chore(docs): update `README.md` for consistent format and to avoid duplication
|
|
8
|
+
- Updated dependencies [5475347]
|
|
9
|
+
- Updated dependencies [e729d58]
|
|
10
|
+
- @ai-sdk/openai@4.0.102
|
|
11
|
+
- @ai-sdk/provider@4.0.34
|
|
12
|
+
- @ai-sdk/provider-utils@5.0.68
|
|
13
|
+
- @ai-sdk/anthropic@4.0.88
|
|
14
|
+
|
|
15
|
+
## 5.0.123
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [8202f5b]
|
|
20
|
+
- Updated dependencies [85d84a1]
|
|
21
|
+
- @ai-sdk/provider-utils@5.0.67
|
|
22
|
+
- @ai-sdk/provider@4.0.33
|
|
23
|
+
- @ai-sdk/anthropic@4.0.87
|
|
24
|
+
- @ai-sdk/openai@4.0.101
|
|
25
|
+
|
|
3
26
|
## 5.0.122
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -7,10 +7,8 @@ contains language model support for the Amazon Bedrock [converse API](https://do
|
|
|
7
7
|
|
|
8
8
|
## Setup
|
|
9
9
|
|
|
10
|
-
The Amazon Bedrock provider is available in the `@ai-sdk/amazon-bedrock` module. You can install it with
|
|
11
|
-
|
|
12
10
|
```bash
|
|
13
|
-
npm i @ai-sdk/amazon-bedrock
|
|
11
|
+
npm i ai @ai-sdk/amazon-bedrock
|
|
14
12
|
```
|
|
15
13
|
|
|
16
14
|
## Skill for Coding Agents
|
|
@@ -21,90 +19,7 @@ If you use coding agents such as Claude Code or Cursor, we highly recommend addi
|
|
|
21
19
|
npx skills add vercel/ai
|
|
22
20
|
```
|
|
23
21
|
|
|
24
|
-
##
|
|
25
|
-
|
|
26
|
-
You can import the default provider instance `bedrock` from `@ai-sdk/amazon-bedrock`:
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
import { bedrock } from '@ai-sdk/amazon-bedrock';
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Authentication
|
|
33
|
-
|
|
34
|
-
The Amazon Bedrock provider supports two authentication methods with automatic fallback:
|
|
35
|
-
|
|
36
|
-
### API Key Authentication (Recommended)
|
|
37
|
-
|
|
38
|
-
API key authentication provides a simpler setup process compared to traditional AWS SigV4 authentication. You can authenticate using either environment variables or direct configuration.
|
|
39
|
-
|
|
40
|
-
#### Using Environment Variable
|
|
41
|
-
|
|
42
|
-
Set the `AWS_BEARER_TOKEN_BEDROCK` environment variable with your API key:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
export AWS_BEARER_TOKEN_BEDROCK=your-api-key-here
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { bedrock } from '@ai-sdk/amazon-bedrock';
|
|
50
|
-
import { generateText } from 'ai';
|
|
51
|
-
|
|
52
|
-
const { text } = await generateText({
|
|
53
|
-
model: bedrock('us.anthropic.claude-haiku-5-5'),
|
|
54
|
-
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
|
|
55
|
-
// API key is automatically loaded from AWS_BEARER_TOKEN_BEDROCK
|
|
56
|
-
});
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
#### Using Direct Configuration
|
|
60
|
-
|
|
61
|
-
You can also pass the API key directly in the provider configuration:
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
import { bedrock } from '@ai-sdk/amazon-bedrock';
|
|
65
|
-
import { generateText } from 'ai';
|
|
66
|
-
|
|
67
|
-
const bedrockWithApiKey = bedrock.withSettings({
|
|
68
|
-
apiKey: process.env.AWS_BEARER_TOKEN_BEDROCK, // or your API key directly
|
|
69
|
-
region: 'us-east-1', // Optional: specify region
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const { text } = await generateText({
|
|
73
|
-
model: bedrockWithApiKey('us.anthropic.claude-haiku-5-5'),
|
|
74
|
-
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
|
|
75
|
-
});
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### SigV4 Authentication (Fallback)
|
|
79
|
-
|
|
80
|
-
If no API key is provided, the provider automatically falls back to AWS SigV4 authentication using standard AWS credentials:
|
|
81
|
-
|
|
82
|
-
```ts
|
|
83
|
-
import { bedrock } from '@ai-sdk/amazon-bedrock';
|
|
84
|
-
import { generateText } from 'ai';
|
|
85
|
-
|
|
86
|
-
// Uses AWS credentials from environment variables or AWS credential chain
|
|
87
|
-
const { text } = await generateText({
|
|
88
|
-
model: bedrock('us.anthropic.claude-haiku-5-5'),
|
|
89
|
-
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
|
|
90
|
-
});
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
This method requires standard AWS environment variables:
|
|
94
|
-
|
|
95
|
-
- `AWS_ACCESS_KEY_ID`
|
|
96
|
-
- `AWS_SECRET_ACCESS_KEY`
|
|
97
|
-
- `AWS_SESSION_TOKEN` (optional, for temporary credentials)
|
|
98
|
-
|
|
99
|
-
### Authentication Precedence
|
|
100
|
-
|
|
101
|
-
The provider uses the following authentication precedence:
|
|
102
|
-
|
|
103
|
-
1. **API key from direct configuration** (`apiKey` in `withSettings()`)
|
|
104
|
-
2. **API key from environment variable** (`AWS_BEARER_TOKEN_BEDROCK`)
|
|
105
|
-
3. **SigV4 authentication** (AWS credential chain fallback)
|
|
106
|
-
|
|
107
|
-
## Example
|
|
22
|
+
## Usage
|
|
108
23
|
|
|
109
24
|
```ts
|
|
110
25
|
import { bedrock } from '@ai-sdk/amazon-bedrock';
|
|
@@ -116,6 +31,4 @@ const { text } = await generateText({
|
|
|
116
31
|
});
|
|
117
32
|
```
|
|
118
33
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
Please check out the **[Amazon Bedrock provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock)** for more information.
|
|
34
|
+
See the [Amazon Bedrock Provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock) for more information.
|
package/dist/anthropic/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { z } from "zod/v4";
|
|
|
6
6
|
import { EventStreamCodec } from "@smithy/eventstream-codec";
|
|
7
7
|
import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
|
|
8
8
|
//#region src/version.ts
|
|
9
|
-
const VERSION = "5.0.
|
|
9
|
+
const VERSION = "5.0.124";
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/amazon-bedrock-sigv4-fetch.ts
|
|
12
12
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2334,7 +2334,7 @@ const amazonBedrockImageResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
|
2334
2334
|
})));
|
|
2335
2335
|
//#endregion
|
|
2336
2336
|
//#region src/version.ts
|
|
2337
|
-
const VERSION = "5.0.
|
|
2337
|
+
const VERSION = "5.0.124";
|
|
2338
2338
|
//#endregion
|
|
2339
2339
|
//#region src/amazon-bedrock-sigv4-fetch.ts
|
|
2340
2340
|
/**
|
package/dist/mantle/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ let _ai_sdk_provider = require("@ai-sdk/provider");
|
|
|
4
4
|
let _ai_sdk_provider_utils = require("@ai-sdk/provider-utils");
|
|
5
5
|
let aws4fetch = require("aws4fetch");
|
|
6
6
|
//#region src/version.ts
|
|
7
|
-
const VERSION = "5.0.
|
|
7
|
+
const VERSION = "5.0.124";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/amazon-bedrock-sigv4-fetch.ts
|
|
10
10
|
/**
|
package/dist/mantle/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { InvalidArgumentError, NoSuchModelError } from "@ai-sdk/provider";
|
|
|
3
3
|
import { combineHeaders, getRuntimeEnvironmentUserAgent, isValidHostnamePart, loadOptionalSetting, loadSetting, normalizeHeaders, withUserAgentSuffix, withoutTrailingSlash } from "@ai-sdk/provider-utils";
|
|
4
4
|
import { AwsV4Signer } from "aws4fetch";
|
|
5
5
|
//#region src/version.ts
|
|
6
|
-
const VERSION = "5.0.
|
|
6
|
+
const VERSION = "5.0.124";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/amazon-bedrock-sigv4-fetch.ts
|
|
9
9
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/amazon-bedrock",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.124",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@ai-sdk/anthropic": "4.0.
|
|
45
|
-
"@ai-sdk/openai": "4.0.
|
|
46
|
-
"@ai-sdk/provider": "4.0.
|
|
47
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
44
|
+
"@ai-sdk/anthropic": "4.0.88",
|
|
45
|
+
"@ai-sdk/openai": "4.0.102",
|
|
46
|
+
"@ai-sdk/provider": "4.0.34",
|
|
47
|
+
"@ai-sdk/provider-utils": "5.0.68",
|
|
48
48
|
"@smithy/eventstream-codec": "^4.3.3",
|
|
49
49
|
"@smithy/util-utf8": "^4.3.3",
|
|
50
50
|
"aws4fetch": "^1.0.20"
|