chore: Align example config keys and env vars with new naming#29
Open
jsonbailey wants to merge 6 commits into
Open
chore: Align example config keys and env vars with new naming#29jsonbailey wants to merge 6 commits into
jsonbailey wants to merge 6 commits into
Conversation
Align hello-python-ai examples with the new env var and default config-key naming established in js-core PR #1379: LAUNCHDARKLY_AI_CONFIG_KEY -> LAUNCHDARKLY_COMPLETION_KEY sample-completion-config -> sample-completion LAUNCHDARKLY_AGENT_CONFIG_KEY -> LAUNCHDARKLY_AGENT_KEY sample-agent-config -> sample-agent LAUNCHDARKLY_AI_JUDGE_KEY -> LAUNCHDARKLY_JUDGE_KEY sample-ai-judge -> sample-judge LAUNCHDARKLY_ANALYZER_CONFIG_KEY -> LAUNCHDARKLY_ANALYZER_KEY LAUNCHDARKLY_DOCUMENTATION_CONFIG_KEY -> LAUNCHDARKLY_DOCUMENTATION_KEY The state_graph example's analyzer/documentation defaults (code-review-analyzer / code-review-documentation) already match the new no-suffix naming and are unchanged. LAUNCHDARKLY_AGENT_GRAPH_KEY / sample-agent-graph are also unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Each example directory now ships a `.env.example` listing the env vars that example reads, with empty values for the user to fill in. Each per-example README now points at it with a `cp .env.example .env` step instead of inlining the variable list. `.env` is already covered by .gitignore. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
andrewklatzke
approved these changes
May 13, 2026
…nv files Python's os.getenv(key, default) returns the default only when the var is unset. dotenv loads `KEY=` as a *set* empty string, so a user who copies `.env.example` to `.env` without editing would silently get an empty string and the AI Config lookup would fail. Setting the documented defaults inline (e.g. LAUNCHDARKLY_COMPLETION_KEY= sample-completion) fixes that and removes the duplicate "defaults to X" comments. Required vars (SDK key, provider keys) stay blank. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…mple env files Extend the previous commit's rule to every documented optional env var in the example .env.example files: if the comment says "defaults to X", the value is set to X inline and the comment is reworded to "Override...". This covers AWS_DEFAULT_REGION in the bedrock example, which had the same os.getenv(key, default) vs dotenv-loads-empty-string bug as the LaunchDarkly config-key vars. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
JS-side reviewer flagged that provider error responses may include credentials (OpenAI has historically echoed API keys back in error JSON). The examples intentionally print the raw exception so users can see what's wrong without modifying code, but a short comment above each top-level catch-and-log explains that production code should sanitize errors first. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The three-line caveat above each top-level catch-and-log is now a single line directly above the print call, which keeps the security note tied to the actual logging statement rather than to the except clause. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Back-port of the naming changes landed in js-core PR #1379 (launchdarkly/js-core#1379). Drops the
_CONFIG_KEYenv-var suffix and the trailing-config/-ai-on the default AI Config keys so the names are consistent and concise across SDKs.LAUNCHDARKLY_AI_CONFIG_KEYsample-completion-configLAUNCHDARKLY_COMPLETION_KEYsample-completionLAUNCHDARKLY_AGENT_CONFIG_KEYsample-agent-configLAUNCHDARKLY_AGENT_KEYsample-agentLAUNCHDARKLY_AI_JUDGE_KEYsample-ai-judgeLAUNCHDARKLY_JUDGE_KEYsample-judgeLAUNCHDARKLY_ANALYZER_CONFIG_KEYcode-review-analyzerLAUNCHDARKLY_ANALYZER_KEYLAUNCHDARKLY_DOCUMENTATION_CONFIG_KEYcode-review-documentationLAUNCHDARKLY_DOCUMENTATION_KEYLAUNCHDARKLY_AGENT_GRAPH_KEY/sample-agent-graphwere already aligned and are unchanged.Also adds a
.env.exampleto each of the 10 example directories — the repo usespython-dotenvbut didn't ship samples. Each.env.examplelists only the env vars the example actually reads.Test plan
poetry run openai-exampleruns end-to-end against an AI Config and prints the metric summary