Class BedrockMessagesAsyncExample
-
- All Implemented Interfaces:
public final class BedrockMessagesAsyncExampleAn example of retrieving messages from an Anthropic model running on the Amazon Bedrock backend using an asynchronous client.
To use the BedrockBackend, the SDK module for Bedrock must be added to the dependencies. Many of the other examples can be adapted to create a client with the
BedrockBackend. Once a client is created, the rest of the code does not need to be changed (subject to the endpoint being supported). See the SDK documentation for details on dependencies and endpoint support for Bedrock.AWS credentials must be configured to access Amazon Bedrock. This example sets the required credentials explicitly from a combination of environment variables and hard-coded values. Alternatively, the credentials and region can be resolved automatically from other sources. See BedrockMessagesStreamingAsyncExample for comparison.
To run this example, set the following environment variables which will be accessed directly from the code (the region is hard-coded):
AWS_ACCESS_KEY_ID: The AWS access key ID identifying the service user.AWS_SECRET_ACCESS_KEY: The AWS secret access key used to sign the requests to the AWS service.