Skip to content

Commit

Permalink
edits to aws guide
Browse files Browse the repository at this point in the history
  • Loading branch information
ksolo committed Sep 20, 2024
1 parent b5f35d0 commit c861a14
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions guides/aws_bedrock.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# AWS Bedrock

To use AWS Bedrock with `aisuite` you will need to create an AWS account and
navigate to `https://us-west-2.console.aws.amazon.com/bedrock/home`. This route
navigate to `https://console.aws.amazon.com/bedrock/home`. This route
will be redirected to your default region. In this example the region has been set to
`us-west-2`. Anywhere that is listed can be replaced with your desired region.
`us-west-2`. Anywhere the region is specified can be replaced with your desired region.

Navigate to the `[overview](https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/overview)` page
directly or by clicking on the `Get started` link.
Expand All @@ -12,16 +12,21 @@ directly or by clicking on the `Get started` link.

You will first need to give your AWS account access to the foundation models by
visiting the `[modelaccess](https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/modelaccess)`
page to enable the models you would like to use. Make note of the `Model ID` for the model you would like to use,
this will be used when using the chat completion example below.
page to enable the models you would like to use.

After enabling the foundation models, navigate to [providers page](https://us-west-2.console.aws.amazon.com/bedrock/home?region=us-west-2#/providers)
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
make note of the `Model ID` (currently located near the bottom) this will be used when using the chat completion example below.

Once that has been enabled set your Access Key and Secret in the env variables:

```shell
export AWS_ACCESS_KEY="your-access-key"
export AWS_SECRET_KEY="your-secret-key"
export AWS_REGION_NAME="region-name"
export AWS_REGION_NAME="region-name"
```
*Note: AWS_REGION_NAME is optional, a default of `us-west-2` has been set for easy of use*

## Create a Chat Completion

Install the boto3 client using your package installer
Expand All @@ -42,8 +47,8 @@ import aisuite as ai
client = ai.Client()


model_id = "meta.llama3-1-405b-instruct-v1:0" # Model ID from above
provider = "aws-bedrock"
model_id = "meta.llama3-1-405b-instruct-v1:0" # Model ID from above

messages = [
{"role": "system", "content": "Respond in Pirate English."},
Expand Down

0 comments on commit c861a14

Please sign in to comment.