- Install and configure the AWS CLI, which you need to connect to Bedrock
- List available Writer models on Bedrock
- Use the AWS
boto3Python SDK to invoke Palmyra models on Bedrock
Prerequisites
Before interacting with Palmyra models on Bedrock, you need an AWS account with access to Bedrock.Install and configure the AWS CLI
- Install the AWS CLI.
- Configure the AWS CLI with your AWS credentials. You can configure the CLI using the following command and providing your AWS account credentials:
- Test that your AWS CLI is configured correctly by running the following command:
Install the AWS boto3 SDK for Python
To invoke Palmyra models on Bedrock using Python, you can use the AWSboto3 SDK.
Install the boto3 SDK using the following command:
Subscribe to Bedrock Models
To subscribe to the Palmyra X5 and Palmyra X4 models on Bedrock, go to the Bedrock console and request access to the Writer models you want to use. You can also list the available models from Writer using the following command:Use Palmyra X5 and Palmyra X4 on with the AWS Python SDK
The following example uses theboto3 Python SDK to create a chat completion with the Palmyra X5 model on Bedrock. The modelId is us.writer.palmyra-x5-v1:0, which is the ID for the cross-region inference profile for Palmyra X5.
boto3 (Python SDK)
converse method in the boto3 Python SDK documentation.
Example: Summarize a meeting transcript
The following example uses Palmyra X5 to summarize a meeting transcript and provide a list of action items from the transcript. It takes a meeting transcript text file, passes it to Palmyra X5 with instructions to provide a summary of the meeting and a list of action items, and prints the response.boto3 (Python SDK)
Additional resources
See more information and examples below:- AWS blog post about Palmyra X5 and X4 on Bedrock
- Additional code examples for Amazon Bedrock