Initializing the Bedrock client
When working with Amazon Bedrock, the first step is to initialize the client with the correct region. The region_name
parameter in the client initialization ensures your application connects to the right geographical endpoint where the Bedrock service is hosted. Practice setting up the client and print the available models to confirm the connection.
This exercise is part of the course
Introduction to Amazon Bedrock
Exercise instructions
- Import the
boto3
library. - Verify the connection by listing the available foundation models.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import the boto 3 library
import ____
bedrock = boto3.client(
'bedrock', region_name='us-east-1'
)
# List available models
models = bedrock.____
print(models['modelSummaries'])