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-config.
- Create an AI Config with a Bedrock model and a system message. Default key:
-
Create a
.envfile in this directory with the following variables:LAUNCHDARKLY_SDK_KEY=your-launchdarkly-sdk-key LAUNCHDARKLY_AI_CONFIG_KEY=sample-completion-configLAUNCHDARKLY_AI_CONFIG_KEYdefaults tosample-completion-configif not set. -
Ensure your AWS credentials can be auto-detected by the
boto3library. You can set them in your.envfile:AWS_ACCESS_KEY_ID=your-access-key-id AWS_SECRET_ACCESS_KEY=your-secret-access-key AWS_DEFAULT_REGION=us-east-1Other options include role providers or shared credential files.
-
Install the required dependencies:
poetry install
poetry run bedrock