This example demonstrates how to use LaunchDarkly's create_model method, which handles model creation, chat execution, and optional judge evaluation dispatch automatically.
- Python 3.10 or higher
- Poetry installed
- A LaunchDarkly account and SDK key
- API keys for the provider you want to use (OpenAI, Bedrock, or Gemini)
-
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 model and system message. Default key:
sample-completion-config.
- Create an AI Config with a model and 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-config OPENAI_API_KEY=your-openai-api-key -
Install the required dependencies:
poetry install
poetry run managed-model