Elffuss BraidHub

kikocis/continue public

19cfb6ec829a · 7.2 KiBRawPermalink
1---
2title: "How to Configure Amazon Bedrock with Continue"
3slug: ../bedrock
4description: "Configure Amazon Bedrock with Continue to access foundation models like Claude 3.7 Sonnet for chat, Titan for embeddings, and Cohere for reranking, with AWS credential authentication"
5sidebarTitle: "Amazon Bedrock"
6---
7
8Amazon Bedrock is a fully managed service on AWS that provides access to foundation models from various AI companies through a single API.
9
10## How to Set Up Amazon Bedrock Chat Models
11
12We recommend configuring **Claude 3.7 Sonnet** as your chat model.
13
14<Tabs>
15 <Tab title="YAML">
16 ```yaml title="config.yaml"
17 models:
18 - name: Claude 3.7 Sonnet
19 provider: bedrock
20 model: us.anthropic.claude-3-7-sonnet-20250219-v1:0
21 env:
22 region: us-east-1
23 profile: bedrock
24 roles:
25 - chat
26 ```
27 </Tab>
28 <Tab title="JSON">
29 ```json title="config.json"
30 {
31 "models": [
32 {
33 "title": "Claude 3.7 Sonnet",
34 "provider": "bedrock",
35 "model": "us.anthropic.claude-3-7-sonnet-20250219-v1:0",
36 "region": "us-east-1",
37 "profile": "bedrock"
38 }
39 ]
40 }
41 ```
42 </Tab>
43</Tabs>
44
45> If you run into the following error when connecting to the new Claude 3.5 Sonnet 2 models from AWS - `400 Invocation of model ID anthropic.claude-3-5-sonnet-20241022-v2:0 with on-demand throughput isn't supported. Retry your request with the ID or ARN of an inference profile that contains this model.`
46
47> You can fix this using the following config:
48
49<Tabs>
50 <Tab title="YAML">
51 ```yaml title="config.yaml"
52 models:
53 - name: Claude 3.5 Sonnet
54 provider: bedrock
55 model: us.anthropic.claude-3-5-sonnet-20241022-v2:0
56 env:
57 region: us-east-1
58 profile: bedrock
59 roles:
60 - chat
61 ```
62 </Tab>
63 <Tab title="JSON">
64 ```json title="config.json"
65 {
66 "models": [
67 {
68 "title": "Claude 3.5 Sonnet",
69 "provider": "bedrock",
70 "model": "us.anthropic.claude-3-5-sonnet-20241022-v2:0",
71 "region": "us-east-1",
72 "profile": "bedrock"
73 }
74 ]
75 }
76 ```
77 </Tab>
78</Tabs>
79
80## How to Set Up Amazon Bedrock Autocomplete Models
81
82Bedrock currently does not offer any autocomplete models. However, [Codestral from Mistral](https://mistral.ai/news/codestral-2501/) and [Point from Poolside](https://aws.amazon.com/bedrock/poolside/) will be supported in the near future.
83
84In the meantime, you can view a list of autocomplete model providers [here](../../model-roles/autocomplete).
85
86## How to Configure Amazon Bedrock Embeddings Models
87
88We recommend configuring [`amazon.titan-embed-text-v2:0`](https://docs.aws.amazon.com/bedrock/latest/devguide/models.html#amazon.titan-embed-text-v2-0) as your embeddings model.
89
90<Tabs>
91 <Tab title="YAML">
92 ```yaml title="config.yaml"
93 models:
94 - name: Embeddings Model
95 provider: bedrock
96 model: amazon.titan-embed-text-v2:0
97 env:
98 region: us-west-2
99 roles:
100 - embed
101 ```
102 </Tab>
103 <Tab title="JSON">
104 ```json title="config.json"
105 {
106 "embeddingsProvider": {
107 "title": "Embeddings Model",
108 "provider": "bedrock",
109 "model": "amazon.titan-embed-text-v2:0",
110 "region": "us-west-2"
111 }
112 }
113 ```
114 </Tab>
115</Tabs>
116
117## How to Configure Amazon Bedrock Reranking Models
118
119We recommend configuring `cohere.rerank-v3-5:0` as your reranking model, you may also use `amazon.rerank-v1:0`.
120
121<Tabs>
122 <Tab title="YAML">
123 ```yaml title="config.yaml"
124 models:
125 - name: Bedrock Reranker
126 provider: bedrock
127 model: cohere.rerank-v3-5:0
128 env:
129 region: us-west-2
130 roles:
131 - rerank
132 ```
133 </Tab>
134 <Tab title="JSON">
135 ```json title="config.json"
136 {
137 "reranker": {
138 "name": "bedrock",
139 "params": {
140 "model": "cohere.rerank-v3-5:0",
141 "region": "us-west-2"
142 }
143 }
144 }
145 ```
146 </Tab>
147</Tabs>
148
149## How to Enable Prompt Caching with Amazon Bedrock
150
151Bedrock allows Claude models to cache tool payloads, system messages, and chat
152messages between requests. Enable this behavior by adding
153`promptCaching: true` under `defaultCompletionOptions` in your model
154configuration.
155
156Prompt caching is generally available for:
157
158- Claude 3.7 Sonnet
159- Claude 3.5 Haiku
160- Amazon Nova Micro
161- Amazon Nova Lite
162- Amazon Nova Pro
163
164Customers who were granted access to Claude 3.5 Sonnet v2 during the prompt
165caching preview will retain that access, but it cannot be enabled for new users
166on that model.
167
168```yaml title="config.yaml"
169models:
170 - name: Claude 3.7 Sonnet
171 provider: bedrock
172 model: us.anthropic.claude-3-7-sonnet-20250219-v1:0
173 defaultCompletionOptions:
174 promptCaching: true
175```
176
177Prompt caching is not supported in JSON configuration files, so use the YAML syntax above to enable it.
178
179## How to Set Up Authentication for Amazon Bedrock
180
181Authentication will be through temporary or long-term credentials in
182`~/.aws/credentials` under a configured profile (e.g. "bedrock").
183
184```title="~/.aws/credentials
185[bedrock]
186aws_access_key_id = abcdefg
187aws_secret_access_key = hijklmno
188aws_session_token = pqrstuvwxyz # Optional: means short term creds.
189```
190
191You can also use an AWS `accessKeyId` and `secretAccessKey` for authentication instead of a local credentials profile.
192
193<Tabs>
194 <Tab title="YAML">
195 ```yaml title="config.yaml"
196 models:
197 - name: Claude 3.7 Sonnet
198 provider: bedrock
199 model: us.anthropic.claude-3-7-sonnet-20250219-v1:0
200 env:
201 region: us-east-1
202 accessKeyId: ${{ secrets.AWS_ACCESS_KEY_ID }} # can also enter key inline here for local assistants
203 secretAccessKey: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # can also enter key inline here for local assistants
204 roles:
205 - chat
206 ```
207 </Tab>
208 <Tab title="JSON">
209 ```json title="config.json"
210 {
211 "models": [
212 {
213 "title": "Claude 3.7 Sonnet",
214 "provider": "bedrock",
215 "model": "us.anthropic.claude-3-7-sonnet-20250219-v1:0",
216 "region": "us-east-1",
217 "accessKeyId": "[YOUR_ACCESS_KEY_ID]",
218 "secretAccessKey": "[YOUR_SECRET_ACCESS_KEY]"
219 }
220 ]
221 }
222 ```
223 </Tab>
224</Tabs>
225
226## How to Configure Custom Imported Models with Amazon Bedrock
227
228To setup Bedrock using custom imported models, add the following to your config file:
229
230<Tabs>
231 <Tab title="YAML">
232 ```yaml title="config.yaml"
233 models:
234 - name: AWS Bedrock deepseek-coder-6.7b-instruct
235 provider: bedrockimport
236 model: deepseek-coder-6.7b-instruct
237 env:
238 region: us-west-2
239 profile: bedrock
240 modelArn: arn:aws:bedrock:us-west-2:XXXXX:imported-model/XXXXXX
241 ```
242 </Tab>
243 <Tab title="JSON">
244 ```json title="config.json"
245 {
246 "models": [
247 {
248 "title": "AWS Bedrock deepseek-coder-6.7b-instruct",
249 "provider": "bedrockimport",
250 "model": "deepseek-coder-6.7b-instruct",
251 "modelArn": "arn:aws:bedrock:us-west-2:XXXXX:imported-model/XXXXXX",
252 "region": "us-west-2",
253 "profile": "bedrock"
254 }
255 ]
256 }
257 ```
258 </Tab>
259</Tabs>
260
261Authentication will be through temporary or long-term credentials in
262~/.aws/credentials under a configured profile (e.g. "bedrock").
263
264```title="~/.aws/credentials
265[bedrock]
266aws_access_key_id = abcdefg
267aws_secret_access_key = hijklmno
268aws_session_token = pqrstuvwxyz # Optional: means short term creds.
269```