diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e9f612..c695cb5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: - name: Install dependencies run: | - for dir in getting_started/completion_config/*/ getting_started/agent_config/*/ features/*/; do + for dir in getting_started/*/**/ features/*/; do echo "Installing $dir" poetry -C "$dir" install done diff --git a/README.md b/README.md index 9e36997..1a9e14f 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,16 @@ For more comprehensive instructions, visit the [Quickstart page](https://docs.la ## Getting Started -These examples show how to integrate LaunchDarkly AI with different providers using `completion_config` and `agent_config`. +These examples show how to integrate LaunchDarkly AI with different providers. -| Example | Description | -| --- | --- | -| [Bedrock](getting_started/completion_config/bedrock/) | `completion_config` with AWS Bedrock, metrics tracking | -| [Gemini](getting_started/completion_config/gemini/) | `completion_config` with Google Gemini, metrics tracking | -| [LangChain](getting_started/completion_config/langchain/) | `completion_config` with LangChain, async metrics tracking | -| [LangGraph Agent](getting_started/agent_config/langgraph_agent/) | `agent_config` with a single LangGraph ReAct agent, tool calling, metrics tracking | -| [LangGraph Multi-Agent](getting_started/agent_config/langgraph_multi_agent/) | `agent_config` with multiple LangGraph agents, custom StateGraph workflow, per-node metrics | -| [OpenAI](getting_started/completion_config/openai/) | `completion_config` with OpenAI, automatic metrics tracking | +| Provider | Example | Description | +| --- | --- | --- | +| Bedrock | [Converse](getting_started/bedrock/converse/) | `completion_config` with AWS Bedrock Converse API, metrics tracking | +| Gemini | [Generate Content](getting_started/gemini/generate_content/) | `completion_config` with Google GenAI, metrics tracking | +| LangChain | [Invoke](getting_started/langchain/invoke/) | `completion_config` with LangChain, async metrics tracking | +| LangGraph | [ReAct Agent](getting_started/langgraph/react_agent/) | `agent_config` with a single LangGraph ReAct agent, tool calling, metrics tracking | +| LangGraph | [StateGraph](getting_started/langgraph/state_graph/) | `agent_config` with multiple LangGraph agents, custom StateGraph workflow, per-node metrics | +| OpenAI | [Chat Completions](getting_started/openai/chat_completions/) | `completion_config` with OpenAI, automatic metrics tracking | ## Features @@ -30,7 +30,7 @@ These examples demonstrate LaunchDarkly's managed APIs and standalone capabiliti | Example | Description | | --- | --- | -| [Judge](features/judge/) | `create_judge` for standalone evaluation of AI responses | -| [Managed Agent](features/managed_agent/) | `create_agent` with tool calling, automatic metrics tracking, and judge evaluation | -| [Managed Agent Graph](features/managed_agent_graph/) | `create_agent_graph` with multi-node workflows, tool calling, per-node metrics, and judge evaluation | -| [Managed Model](features/managed_model/) | `create_model` with managed chat, automatic metrics tracking, and judge evaluation | +| [create_judge](features/create_judge/) | Standalone evaluation of AI responses | +| [create_agent](features/create_agent/) | Tool calling, automatic metrics tracking, and judge evaluation | +| [create_agent_graph](features/create_agent_graph/) | Multi-node workflows, tool calling, per-node metrics, and judge evaluation | +| [create_model](features/create_model/) | Managed chat, automatic metrics tracking, and judge evaluation | diff --git a/features/managed_agent/README.md b/features/create_agent/README.md similarity index 81% rename from features/managed_agent/README.md rename to features/create_agent/README.md index 520afc0..33777a6 100644 --- a/features/managed_agent/README.md +++ b/features/create_agent/README.md @@ -1,6 +1,6 @@ -# Managed Agent Example +# Create Agent Example -This example demonstrates how to use LaunchDarkly's managed agent functionality, which handles model creation, metric tracking, and judge evaluation dispatch automatically. +This example demonstrates how to use LaunchDarkly's `create_agent` method, which handles model creation, metric tracking, and judge evaluation dispatch automatically. ## Prerequisites diff --git a/features/managed_agent/managed_agent_example.py b/features/create_agent/create_agent_example.py similarity index 96% rename from features/managed_agent/managed_agent_example.py rename to features/create_agent/create_agent_example.py index 80d5a76..6f7fa72 100644 --- a/features/managed_agent/managed_agent_example.py +++ b/features/create_agent/create_agent_example.py @@ -71,7 +71,7 @@ async def async_main(): ) if not agent: - print(f"*** Failed to create agent for key: {agent_config_key}") + print(f"AI config '{agent_config_key}' is disabled. Verify the config key exists in your LaunchDarkly project and is not targeting a disabled variation.") return sample_question = 'What is the weather in Tokyo?' diff --git a/features/managed_agent/pyproject.toml b/features/create_agent/pyproject.toml similarity index 88% rename from features/managed_agent/pyproject.toml rename to features/create_agent/pyproject.toml index c235f4f..9bc2c9e 100644 --- a/features/managed_agent/pyproject.toml +++ b/features/create_agent/pyproject.toml @@ -5,10 +5,10 @@ description = "Hello LaunchDarkly for Python AI - Managed Agent" authors = ["LaunchDarkly "] license = "Apache-2.0" readme = "README.md" -packages = [{include = "managed_agent_example.py"}] +packages = [{include = "create_agent_example.py"}] [tool.poetry.scripts] -agent = "managed_agent_example:main" +agent = "create_agent_example:main" [tool.poetry.dependencies] python = "^3.10" diff --git a/features/managed_agent_graph/README.md b/features/create_agent_graph/README.md similarity index 83% rename from features/managed_agent_graph/README.md rename to features/create_agent_graph/README.md index a75cebd..2592de1 100644 --- a/features/managed_agent_graph/README.md +++ b/features/create_agent_graph/README.md @@ -1,6 +1,6 @@ -# Managed Agent Graph Example +# Create Agent Graph Example -This example demonstrates how to use LaunchDarkly's managed agent graph functionality, which orchestrates multi-node agent workflows with automatic metric tracking at both the graph and per-node level. +This example demonstrates how to use LaunchDarkly's `create_agent_graph` method, which orchestrates multi-node agent workflows with automatic metric tracking at both the graph and per-node level. ## Prerequisites diff --git a/features/managed_agent_graph/managed_agent_graph_example.py b/features/create_agent_graph/create_agent_graph_example.py similarity index 96% rename from features/managed_agent_graph/managed_agent_graph_example.py rename to features/create_agent_graph/create_agent_graph_example.py index e62683d..c30b9e3 100644 --- a/features/managed_agent_graph/managed_agent_graph_example.py +++ b/features/create_agent_graph/create_agent_graph_example.py @@ -74,7 +74,7 @@ async def async_main(): ) if not graph: - print(f"*** Failed to create agent graph for key: {graph_key}") + print(f"AI config '{graph_key}' is disabled. Verify the config key exists in your LaunchDarkly project and is not targeting a disabled variation.") return sample_question = 'Plan a trip to Tokyo next week. Find flights, hotels, and check the weather.' diff --git a/features/managed_agent_graph/pyproject.toml b/features/create_agent_graph/pyproject.toml similarity index 86% rename from features/managed_agent_graph/pyproject.toml rename to features/create_agent_graph/pyproject.toml index 01857d4..febcd58 100644 --- a/features/managed_agent_graph/pyproject.toml +++ b/features/create_agent_graph/pyproject.toml @@ -5,10 +5,10 @@ description = "Hello LaunchDarkly for Python AI - Managed Agent Graph" authors = ["LaunchDarkly "] license = "Apache-2.0" readme = "README.md" -packages = [{include = "managed_agent_graph_example.py"}] +packages = [{include = "create_agent_graph_example.py"}] [tool.poetry.scripts] -agent-graph = "managed_agent_graph_example:main" +agent-graph = "create_agent_graph_example:main" [tool.poetry.dependencies] python = "^3.10" diff --git a/features/judge/README.md b/features/create_judge/README.md similarity index 81% rename from features/judge/README.md rename to features/create_judge/README.md index f97539e..f5d0cd9 100644 --- a/features/judge/README.md +++ b/features/create_judge/README.md @@ -1,6 +1,6 @@ -# Judge Example (Direct Evaluation) +# Create Judge Example -This example demonstrates how to use LaunchDarkly's judge functionality to evaluate specific input/output pairs directly, without an associated chat session. +This example demonstrates how to use LaunchDarkly's `create_judge` method to evaluate specific input/output pairs directly, without an associated chat session. ## Prerequisites diff --git a/features/judge/judge_example.py b/features/create_judge/create_judge_example.py similarity index 95% rename from features/judge/judge_example.py rename to features/create_judge/create_judge_example.py index eda5e38..813fcb9 100644 --- a/features/judge/judge_example.py +++ b/features/create_judge/create_judge_example.py @@ -66,7 +66,7 @@ async def async_main(): judge = aiclient.create_judge(judge_key, context) if not judge: - print(f"*** Failed to create judge for key: {judge_key}") + print(f"AI config '{judge_key}' is disabled. Verify the config key exists in your LaunchDarkly project and is not targeting a disabled variation.") return input_text = 'You are a helpful assistant for the company LaunchDarkly. How can you help me?' diff --git a/features/judge/pyproject.toml b/features/create_judge/pyproject.toml similarity index 87% rename from features/judge/pyproject.toml rename to features/create_judge/pyproject.toml index 7eb3f7c..421f082 100644 --- a/features/judge/pyproject.toml +++ b/features/create_judge/pyproject.toml @@ -5,10 +5,10 @@ description = "Hello LaunchDarkly for Python AI - Judge" authors = ["LaunchDarkly "] license = "Apache-2.0" readme = "README.md" -packages = [{include = "judge_example.py"}] +packages = [{include = "create_judge_example.py"}] [tool.poetry.scripts] -judge = "judge_example:main" +judge = "create_judge_example:main" [tool.poetry.dependencies] python = "^3.10" diff --git a/features/managed_model/README.md b/features/create_model/README.md similarity index 77% rename from features/managed_model/README.md rename to features/create_model/README.md index a176bbb..80f049c 100644 --- a/features/managed_model/README.md +++ b/features/create_model/README.md @@ -1,6 +1,6 @@ -# Managed Model Example +# Create Model Example -This example demonstrates how to use LaunchDarkly's managed model functionality (`create_model`), which handles model creation, chat execution, and optional judge evaluation dispatch automatically. +This example demonstrates how to use LaunchDarkly's `create_model` method, which handles model creation, chat execution, and optional judge evaluation dispatch automatically. ## Prerequisites @@ -32,5 +32,5 @@ This example demonstrates how to use LaunchDarkly's managed model functionality ## Run ```bash -poetry run managed-model +poetry run model ``` diff --git a/features/managed_model/managed_model_example.py b/features/create_model/create_model_example.py similarity index 95% rename from features/managed_model/managed_model_example.py rename to features/create_model/create_model_example.py index 45b7fc5..9022c2d 100644 --- a/features/managed_model/managed_model_example.py +++ b/features/create_model/create_model_example.py @@ -64,7 +64,7 @@ async def async_main(): }) if not chat: - print(f"*** Failed to create chat for key: {ai_config_key}") + print(f"AI config '{ai_config_key}' is disabled. Verify the config key exists in your LaunchDarkly project and is not targeting a disabled variation.") return sample_question = 'How can LaunchDarkly help me?' diff --git a/features/managed_model/pyproject.toml b/features/create_model/pyproject.toml similarity index 86% rename from features/managed_model/pyproject.toml rename to features/create_model/pyproject.toml index 57ee050..7003705 100644 --- a/features/managed_model/pyproject.toml +++ b/features/create_model/pyproject.toml @@ -5,10 +5,10 @@ description = "Hello LaunchDarkly for Python AI - Managed Model" authors = ["LaunchDarkly "] license = "Apache-2.0" readme = "README.md" -packages = [{include = "managed_model_example.py"}] +packages = [{include = "create_model_example.py"}] [tool.poetry.scripts] -managed-model = "managed_model_example:main" +model = "create_model_example:main" [tool.poetry.dependencies] python = "^3.10" diff --git a/getting_started/completion_config/bedrock/README.md b/getting_started/bedrock/converse/README.md similarity index 100% rename from getting_started/completion_config/bedrock/README.md rename to getting_started/bedrock/converse/README.md diff --git a/getting_started/completion_config/bedrock/bedrock_example.py b/getting_started/bedrock/converse/bedrock_example.py similarity index 96% rename from getting_started/completion_config/bedrock/bedrock_example.py rename to getting_started/bedrock/converse/bedrock_example.py index aae970b..2d853da 100755 --- a/getting_started/completion_config/bedrock/bedrock_example.py +++ b/getting_started/bedrock/converse/bedrock_example.py @@ -90,7 +90,7 @@ def main(): ) if not config_value.enabled: - print("AI Config is disabled") + print(f"AI config '{ai_config_key}' is disabled. Verify the config key exists in your LaunchDarkly project and is not targeting a disabled variation.") return tracker = config_value.create_tracker() diff --git a/getting_started/completion_config/bedrock/pyproject.toml b/getting_started/bedrock/converse/pyproject.toml similarity index 100% rename from getting_started/completion_config/bedrock/pyproject.toml rename to getting_started/bedrock/converse/pyproject.toml diff --git a/getting_started/completion_config/gemini/README.md b/getting_started/gemini/generate_content/README.md similarity index 100% rename from getting_started/completion_config/gemini/README.md rename to getting_started/gemini/generate_content/README.md diff --git a/getting_started/completion_config/gemini/gemini_example.py b/getting_started/gemini/generate_content/gemini_example.py similarity index 97% rename from getting_started/completion_config/gemini/gemini_example.py rename to getting_started/gemini/generate_content/gemini_example.py index 3445ea1..22ba7ec 100644 --- a/getting_started/completion_config/gemini/gemini_example.py +++ b/getting_started/gemini/generate_content/gemini_example.py @@ -139,7 +139,7 @@ def main(): ) if not config_value.enabled: - print("AI Config is disabled") + print(f"AI config '{ai_config_key}' is disabled. Verify the config key exists in your LaunchDarkly project and is not targeting a disabled variation.") return tracker = config_value.create_tracker() diff --git a/getting_started/completion_config/gemini/pyproject.toml b/getting_started/gemini/generate_content/pyproject.toml similarity index 100% rename from getting_started/completion_config/gemini/pyproject.toml rename to getting_started/gemini/generate_content/pyproject.toml diff --git a/getting_started/completion_config/langchain/README.md b/getting_started/langchain/invoke/README.md similarity index 100% rename from getting_started/completion_config/langchain/README.md rename to getting_started/langchain/invoke/README.md diff --git a/getting_started/completion_config/langchain/langchain_example.py b/getting_started/langchain/invoke/langchain_example.py similarity index 96% rename from getting_started/completion_config/langchain/langchain_example.py rename to getting_started/langchain/invoke/langchain_example.py index 427a3d8..8fdba44 100644 --- a/getting_started/completion_config/langchain/langchain_example.py +++ b/getting_started/langchain/invoke/langchain_example.py @@ -77,7 +77,7 @@ async def async_main(): ) if not config_value.enabled: - print("AI Config is disabled") + print(f"AI config '{ai_config_key}' is disabled. Verify the config key exists in your LaunchDarkly project and is not targeting a disabled variation.") return tracker = config_value.create_tracker() diff --git a/getting_started/completion_config/langchain/pyproject.toml b/getting_started/langchain/invoke/pyproject.toml similarity index 100% rename from getting_started/completion_config/langchain/pyproject.toml rename to getting_started/langchain/invoke/pyproject.toml diff --git a/getting_started/agent_config/langgraph_agent/README.md b/getting_started/langgraph/react_agent/README.md similarity index 100% rename from getting_started/agent_config/langgraph_agent/README.md rename to getting_started/langgraph/react_agent/README.md diff --git a/getting_started/agent_config/langgraph_agent/langgraph_agent_example.py b/getting_started/langgraph/react_agent/langgraph_agent_example.py similarity index 96% rename from getting_started/agent_config/langgraph_agent/langgraph_agent_example.py rename to getting_started/langgraph/react_agent/langgraph_agent_example.py index 024c17d..ba1a4c9 100644 --- a/getting_started/agent_config/langgraph_agent/langgraph_agent_example.py +++ b/getting_started/langgraph/react_agent/langgraph_agent_example.py @@ -78,7 +78,7 @@ def main(): agent_config = aiclient.agent_config(agent_config_key, context) if not agent_config.enabled: - print("AI Agent Config is disabled") + print(f"AI config '{agent_config_key}' is disabled. Verify the config key exists in your LaunchDarkly project and is not targeting a disabled variation.") return langchain_provider = map_provider_to_langchain(agent_config.provider.name) diff --git a/getting_started/agent_config/langgraph_agent/pyproject.toml b/getting_started/langgraph/react_agent/pyproject.toml similarity index 100% rename from getting_started/agent_config/langgraph_agent/pyproject.toml rename to getting_started/langgraph/react_agent/pyproject.toml diff --git a/getting_started/agent_config/langgraph_multi_agent/README.md b/getting_started/langgraph/state_graph/README.md similarity index 100% rename from getting_started/agent_config/langgraph_multi_agent/README.md rename to getting_started/langgraph/state_graph/README.md diff --git a/getting_started/agent_config/langgraph_multi_agent/langgraph_multi_agent_example.py b/getting_started/langgraph/state_graph/langgraph_multi_agent_example.py similarity index 98% rename from getting_started/agent_config/langgraph_multi_agent/langgraph_multi_agent_example.py rename to getting_started/langgraph/state_graph/langgraph_multi_agent_example.py index f319397..c05edef 100644 --- a/getting_started/agent_config/langgraph_multi_agent/langgraph_multi_agent_example.py +++ b/getting_started/langgraph/state_graph/langgraph_multi_agent_example.py @@ -123,7 +123,7 @@ def ai_node( goto=END, update={ "messages": state["messages"], - state_key: f"AI Config {config_key} is disabled. Node for {config_key} skipped." + state_key: f"AI config '{config_key}' is disabled. Verify the config key exists in your LaunchDarkly project and is not targeting a disabled variation." } ) diff --git a/getting_started/agent_config/langgraph_multi_agent/pyproject.toml b/getting_started/langgraph/state_graph/pyproject.toml similarity index 100% rename from getting_started/agent_config/langgraph_multi_agent/pyproject.toml rename to getting_started/langgraph/state_graph/pyproject.toml diff --git a/getting_started/completion_config/openai/README.md b/getting_started/openai/chat_completions/README.md similarity index 100% rename from getting_started/completion_config/openai/README.md rename to getting_started/openai/chat_completions/README.md diff --git a/getting_started/completion_config/openai/openai_example.py b/getting_started/openai/chat_completions/openai_example.py similarity index 95% rename from getting_started/completion_config/openai/openai_example.py rename to getting_started/openai/chat_completions/openai_example.py index 20749ff..ad59114 100755 --- a/getting_started/completion_config/openai/openai_example.py +++ b/getting_started/openai/chat_completions/openai_example.py @@ -71,7 +71,7 @@ def main(): ) if not config_value.enabled: - print("AI Config is disabled") + print(f"AI config '{ai_config_key}' is disabled. Verify the config key exists in your LaunchDarkly project and is not targeting a disabled variation.") return tracker = config_value.create_tracker() diff --git a/getting_started/completion_config/openai/pyproject.toml b/getting_started/openai/chat_completions/pyproject.toml similarity index 100% rename from getting_started/completion_config/openai/pyproject.toml rename to getting_started/openai/chat_completions/pyproject.toml