This example demonstrates how to use LaunchDarkly's AI Config with the AWS Bedrock provider.
- Python 3.10 or higher
- Poetry installed
- A LaunchDarkly account and SDK key
- AWS credentials configured for Bedrock access
-
Create the following config in your LaunchDarkly project. You can use a different key by setting the environment variable in your
.env.- Create an AI Config with a Bedrock model and a system message. Default key:
sample-completion.
- Create an AI Config with a Bedrock model and a system message. Default key:
-
Copy
.env.exampleto.envand fill in your keys:cp .env.example .env
LAUNCHDARKLY_COMPLETION_KEYdefaults tosample-completionif not set.Ensure your AWS credentials can be auto-detected by the
boto3library. Setting them in.envis one option; role providers or shared credential files are also supported. -
Install the required dependencies:
poetry install
poetry run bedrock