We've built a simple console application that demonstrates how LaunchDarkly's SDK works.
Below, you'll find the build procedure. For more comprehensive instructions, you can visit your Quickstart page or the Python reference guide.
This demo requires Python 3.8 or higher.
This repository includes examples for OpenAI, Bedrock, and LangChain for multi-provider support. Depending on your preferred provider, you may have to take some additional steps.
-
Create an AI Config using the key specified in each example, or copy the key of existing AI Config in your LaunchDarkly project that you want to evaluate.
-
Set the environment variable
LAUNCHDARKLY_SDK_KEYto your LaunchDarkly SDK key andLAUNCHDARKLY_AI_CONFIG_KEYto the AI Config key; otherwise, an AI Config ofsample-ai-configorsample-ai-agent-configwill be assumed for most examples.export LAUNCHDARKLY_SDK_KEY="1234567890abcdef" export LAUNCHDARKLY_AI_CONFIG_KEY="sample-ai-config"
-
Ensure you have Poetry installed.
- Install the required dependencies with
poetry install -E openaiorpoetry install --all-extras. - Set the environment variable
OPENAI_API_KEYto your OpenAI key. - On the command line, run
poetry run openai-example.
- Install the required dependencies with
poetry install -E bedrockorpoetry install --all-extras. - Ensure the required AWS credentials can be auto-detected by the
boto3library. Examples might include environment variables, role providers, or shared credential files. - On the command line, run
poetry run bedrock-example.
- Install the required dependencies with
poetry install -E geminiorpoetry install --all-extras. - Set the environment variable
GOOGLE_API_KEYto your Google API key. - On the command line, run
poetry run gemini-example.
This example uses OpenAI, Bedrock, and Gemini LangChain provider packages. You can add additional LangChain providers using the poetry add command.
- Install all dependencies with
poetry install -E langchainorpoetry install --all-extras. - Set up API keys for the providers you want to use.
- On the command line, run
poetry run langchain-example
- Install all dependencies with
poetry install -E langgraphorpoetry install --all-extras. - Set up API keys for the providers you want to use.
- Optionally set this environment variable to use a different agent config:
export LAUNCHDARKLY_AGENT_CONFIG_KEY="sample-ai-agent-config"
- On the command line, run
poetry run langgraph-agent-example.
- Install all dependencies with
poetry install -E langgraphorpoetry install --all-extras. - Set up API keys for the providers you want to use.
- Create an AI Config (Agent-based) using the keys below. Write a goal for each config and enable it with targeting rules.
- Optionally set these environment variables to use different agent configs:
export LAUNCHDARKLY_ANALYZER_CONFIG_KEY="code-review-analyzer" export LAUNCHDARKLY_DOCUMENTATION_CONFIG_KEY="code-review-documentation"
- On the command line, run
poetry run langgraph-multi-agent-example.