1
1
# AWS Bedrock
2
2
3
3
To use AWS Bedrock with ` aisuite ` you will need to create an AWS account and
4
- navigate to ` https://us-west-2. console.aws.amazon.com/bedrock/home ` . This route
4
+ navigate to ` https://console.aws.amazon.com/bedrock/home ` . This route
5
5
will be redirected to your default region. In this example the region has been set to
6
- ` us-west-2 ` . Anywhere that is listed can be replaced with your desired region.
6
+ ` us-west-2 ` . Anywhere the region is specified can be replaced with your desired region.
7
7
8
8
Navigate to the ` [overview](https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/overview) ` page
9
9
directly or by clicking on the ` Get started ` link.
@@ -12,16 +12,21 @@ directly or by clicking on the `Get started` link.
12
12
13
13
You will first need to give your AWS account access to the foundation models by
14
14
visiting the ` [modelaccess](https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/modelaccess) `
15
- page to enable the models you would like to use. Make note of the ` Model ID ` for the model you would like to use,
16
- this will be used when using the chat completion example below.
15
+ page to enable the models you would like to use.
16
+
17
+ After enabling the foundation models, navigate to [ providers page] ( https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/providers )
18
+ and select the provider of the model you would like to use. From this page select the specific model you would like to use and
19
+ make note of the ` Model ID ` (currently located near the bottom) this will be used when using the chat completion example below.
17
20
18
21
Once that has been enabled set your Access Key and Secret in the env variables:
19
22
20
23
``` shell
21
24
export AWS_ACCESS_KEY=" your-access-key"
22
25
export AWS_SECRET_KEY=" your-secret-key"
23
- export AWS_REGION_NAME=" region-name"
26
+ export AWS_REGION_NAME=" region-name"
24
27
```
28
+ * Note: AWS_REGION_NAME is optional, a default of ` us-west-2 ` has been set for easy of use*
29
+
25
30
## Create a Chat Completion
26
31
27
32
Install the boto3 client using your package installer
@@ -42,8 +47,8 @@ import aisuite as ai
42
47
client = ai.Client()
43
48
44
49
45
- model_id = " meta.llama3-1-405b-instruct-v1:0" # Model ID from above
46
50
provider = " aws-bedrock"
51
+ model_id = " meta.llama3-1-405b-instruct-v1:0" # Model ID from above
47
52
48
53
messages = [
49
54
{" role" : " system" , " content" : " Respond in Pirate English." },
0 commit comments