Skip to content

Commit 16b94fe

Browse files
authored
Sync tutorial docs with published versions (#25)
* Roll forward to launchdarkly-server-sdk-ai 0.20
1 parent 8617514 commit 16b94fe

14 files changed

Lines changed: 984 additions & 1335 deletions

.ai_config_defaults.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"security-agent": {
1010
"enabled": true,
1111
"model": {
12-
"name": "claude-3-5-haiku-20241022",
12+
"name": "claude-haiku-4-5-20251001",
1313
"parameters": {}
1414
},
1515
"provider": {
@@ -20,7 +20,7 @@
2020
"supervisor-agent": {
2121
"enabled": true,
2222
"model": {
23-
"name": "claude-3-7-sonnet-latest",
23+
"name": "claude-sonnet-4-6",
2424
"parameters": {}
2525
},
2626
"provider": {
@@ -31,7 +31,7 @@
3131
"support-agent": {
3232
"enabled": true,
3333
"model": {
34-
"name": "claude-3-5-haiku-20241022",
34+
"name": "claude-haiku-4-5-20251001",
3535
"parameters": {
3636
"tools": [
3737
{

README.md

Lines changed: 180 additions & 118 deletions
Large diffs are not rendered by default.

api/segmentation_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def main():
216216
"user_context": {"country": "DE", "plan": "paid", "user_id": "user_eu_paid_001", "region": "europe"},
217217
"expected_config": {
218218
"support_agent": {
219-
"model": "claude-3-7-sonnet-latest",
219+
"model": "claude-sonnet-4-6",
220220
"variation_key": "eu-paid",
221221
"tools": ["search_v1", "search_v2", "reranking", "arxiv_search", "semantic_scholar"]
222222
}
@@ -227,7 +227,7 @@ def main():
227227
"user_context": {"country": "DE", "plan": "free", "user_id": "user_eu_free_001", "region": "europe"},
228228
"expected_config": {
229229
"support_agent": {
230-
"model": "claude-3-5-haiku-20241022",
230+
"model": "claude-haiku-4-5-20251001",
231231
"variation_key": "eu-free",
232232
"tools": ["search_v1"]
233233
}

bootstrap/ai_config_manifest.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ project:
106106
- key: "supervisor-basic"
107107
modelConfig:
108108
provider: "anthropic"
109-
modelId: "claude-3-5-sonnet-20241022"
109+
modelId: "claude-sonnet-4-6"
110110
# NOTE: After bootstrap, modify instructions in LaunchDarkly UI, not here
111111
instructions: "You are an intelligent routing supervisor for a multi-agent system. Your primary job is to assess whether user input likely contains PII (personally identifiable information) to determine the most efficient processing route.\n\n**PII Assessment:**\nAnalyze the user input and provide:\n- likely_contains_pii: boolean assessment\n- confidence: confidence score (0.0 to 1.0)\n- reasoning: clear explanation of your decision\n- recommended_route: either 'security_agent' or 'support_agent'\n\n**Route to SECURITY_AGENT** if the text likely contains:\n- Email addresses, phone numbers, addresses\n- Names (first/last names, usernames)\n- Financial information (credit cards, SSNs, account numbers)\n- Sensitive personal data\n\n**Route to SUPPORT_AGENT** if the text appears to be:\n- General questions without personal details\n- Technical queries\n- Search requests\n- Educational content requests\n\nAnalyze this user input and recommend the optimal route:"
112112
customParameters:
@@ -123,7 +123,7 @@ project:
123123
- key: "basic-security"
124124
modelConfig:
125125
provider: "anthropic"
126-
modelId: "claude-3-5-haiku-20241022"
126+
modelId: "claude-haiku-4-5-20251001"
127127
# NOTE: After bootstrap, modify instructions in LaunchDarkly UI, not here
128128
instructions: "You are a privacy agent that REMOVES direct PII. Focus on clearly personal identifiers:\n\nEmail addresses\nPhone numbers\nSocial Security Numbers\nFull names (but not generic titles)\nStreet addresses\nCredit card numbers\nDriver's license numbers\n\nResponse Format:\n\ndetected: true if any PII was found, false otherwise\ntypes: array of PII types found (e.g., ['email', 'name', 'phone'])\nredacted: the input text with PII replaced by [REDACTED], keeping the text readable and natural\n\nExamples:\n\nInput: \"I work at Acme Corp in Berlin as a manager\"\n\nOutput: detected=false, types=[], redacted='I work at Acme Corp in Berlin as a manager'\n\n\nInput: \"Contact John Smith at john@email.com or 555-1234\"\n\nOutput: detected=true, types=['name', 'email', 'phone'], redacted='Contact [REDACTED] at [REDACTED] or [REDACTED]'\n\n\nInput: \"The CEO from Microsoft contacted me\"\n\nOutput: detected=false, types=[], redacted='The CEO from Microsoft contacted me'"
129129
customParameters:
@@ -157,7 +157,7 @@ project:
157157
- key: "eu-free"
158158
modelConfig:
159159
provider: "anthropic"
160-
modelId: "claude-3-5-haiku-20241022"
160+
modelId: "claude-haiku-4-5-20251001"
161161
tools: ["search_v1"]
162162
# NOTE: After bootstrap, modify instructions in LaunchDarkly UI, not here
163163
instructions: "You are a helpful assistant with access to basic search (search_v1). Use your search tool to find relevant information from the knowledge base while following EU privacy requirements. Always search before responding to ensure accuracy."
@@ -170,7 +170,7 @@ project:
170170
- key: "eu-paid"
171171
modelConfig:
172172
provider: "anthropic"
173-
modelId: "claude-3-5-sonnet-20241022"
173+
modelId: "claude-sonnet-4-6"
174174
tools: ["search_v1", "search_v2", "reranking", "arxiv_search", "semantic_scholar"]
175175
instructions: "You are a premium research specialist with access to comprehensive RAG tools: search_v1 (basic search), search_v2 (semantic vector search), reranking (BM25 relevance scoring), arxiv_search (academic papers), and semantic_scholar (citation database). When using semantic_scholar, always request as few as possible and less than 5 results (num_results: 5) to optimize performance and avoid rate limiting. When search results are available, prioritize information from those results over your general knowledge. EU privacy laws require strict data handling. Always cite sources and explain confidence levels. Use multiple search approaches for complex queries."
176176
customParameters:
@@ -208,7 +208,7 @@ project:
208208
- key: "international-standard"
209209
modelConfig:
210210
provider: "anthropic" # Default to privacy-friendly
211-
modelId: "claude-3-5-haiku-20241022"
211+
modelId: "claude-haiku-4-5-20251001"
212212
tools: ["search_v1", "search_v2", "reranking"]
213213
instructions: "You are a helpful assistant with access to RAG tools: search_v1 (basic search), search_v2 (semantic vector search), and reranking (BM25 relevance scoring). When search results are available, prioritize information from those results over your general knowledge. Provide balanced, well-researched responses for international users."
214214
customParameters:

bootstrap/create_configs.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ def create_variation(self, project_key, config_key, variation_data):
198198

199199
# Map to correct LaunchDarkly model config keys
200200
model_config_key_map = {
201-
"claude-3-5-sonnet-20241022": "Anthropic.claude-3-7-sonnet-latest",
202-
"claude-3-5-haiku-20241022": "Anthropic.claude-3-5-haiku-20241022",
203-
"claude-opus-4-20250514": "Anthropic.claude-opus-4-20250514",
201+
"claude-sonnet-4-6": "Anthropic.claude-sonnet-4-6",
202+
"claude-haiku-4-5-20251001": "Anthropic.claude-haiku-4-5-20251001",
203+
"claude-opus-4-7": "Anthropic.claude-opus-4-7",
204204
"gpt-4o": "OpenAI.gpt-4o",
205205
"gpt-4o-mini": "OpenAI.gpt-4o-mini-2024-07-18",
206206
"mistral-small-latest": "Mistral.mistral-small-latest"
@@ -269,9 +269,9 @@ def update_variation(self, project_key, config_key, variation_data):
269269

270270
# Map to correct LaunchDarkly model config keys
271271
model_config_key_map = {
272-
"claude-3-5-sonnet-20241022": "Anthropic.claude-3-7-sonnet-latest",
273-
"claude-3-5-haiku-20241022": "Anthropic.claude-3-5-haiku-20241022",
274-
"claude-opus-4-20250514": "Anthropic.claude-opus-4-20250514",
272+
"claude-sonnet-4-6": "Anthropic.claude-sonnet-4-6",
273+
"claude-haiku-4-5-20251001": "Anthropic.claude-haiku-4-5-20251001",
274+
"claude-opus-4-7": "Anthropic.claude-opus-4-7",
275275
"gpt-4o": "OpenAI.gpt-4o",
276276
"gpt-4o-mini": "OpenAI.gpt-4o-mini-2024-07-18",
277277
"mistral-small-latest": "Mistral.mistral-small-latest"

bootstrap/tutorial_3_experiment_variations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def create_premium_model_variations(self) -> bool:
7575
"name": "Claude Opus 4 Treatment",
7676
"instructions": "You are a helpful assistant that can search documentation and research papers. When search results are available, prioritize information from those results over your general knowledge to provide the most accurate and up-to-date responses. Use available tools to search the knowledge base and external research databases to answer questions accurately and comprehensively.",
7777
"model": {
78-
"name": "claude-opus-4-20250514",
78+
"name": "claude-opus-4-7",
7979
"provider": "anthropic"
8080
},
8181
"tools": ["search_v1", "search_v2", "reranking", "arxiv_search", "semantic_scholar"],
@@ -96,7 +96,7 @@ def _create_variations(self, ai_config_key: str, variations: List[Dict[str, Any]
9696
# Map model name to LaunchDarkly modelConfigKey
9797
model_name = variation["model"]["name"]
9898
model_config_key_map = {
99-
"claude-opus-4-20250514": "Anthropic.claude-opus-4-20250514",
99+
"claude-opus-4-7": "Anthropic.claude-opus-4-7",
100100
}
101101

102102
model_config_key = model_config_key_map.get(model_name)

config_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pathlib import Path
99
import ldclient
1010
from ldclient import Context
11-
from ldai import LDAIClient, AIAgentConfigRequest, AIAgentConfigDefault, ModelConfig, ProviderConfig
11+
from ldai import LDAIClient, AIAgentConfigDefault, ModelConfig, ProviderConfig
1212
from ldai.tracker import FeedbackKind
1313
from dotenv import load_dotenv
1414
from utils.logger import log_student, log_debug

tools/concurrent_traffic_generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def evaluate_response(self, query, response):
6868

6969
try:
7070
ai_response = self.claude.messages.create(
71-
model="claude-3-haiku-20240307",
71+
model="claude-haiku-4-5-20251001",
7272
max_tokens=10,
7373
messages=[{"role": "user", "content": prompt}]
7474
)
@@ -88,7 +88,7 @@ def generate_base_topics(self):
8888
"""Generate base RL topics"""
8989
try:
9090
response = self.claude.messages.create(
91-
model="claude-3-5-haiku-20241022",
91+
model="claude-haiku-4-5-20251001",
9292
max_tokens=800,
9393
messages=[{
9494
"role": "user",
@@ -145,7 +145,7 @@ def generate_query(self, topic, inject_pii=False):
145145

146146
try:
147147
response = self.claude.messages.create(
148-
model="claude-3-5-haiku-20241022",
148+
model="claude-haiku-4-5-20251001",
149149
max_tokens=100,
150150
messages=[{"role": "user", "content": prompt}]
151151
)

0 commit comments

Comments
 (0)