Elffuss BraidHub

kikocis/continue public

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