Skip to content

feat: resolve synth LLM provider/model from SSM; retire ~/.g3dt/.env - #11

Merged
JoshuaHarris391 merged 1 commit into
mainfrom
feat/ssm-llm-config
Aug 18, 2026
Merged

feat: resolve synth LLM provider/model from SSM; retire ~/.g3dt/.env#11
JoshuaHarris391 merged 1 commit into
mainfrom
feat/ssm-llm-config

Conversation

@JoshuaHarris391

Copy link
Copy Markdown
Collaborator

Companion to AustralianBioCommons/aws-gen3-pipeline#7. Together they move the synthetic-data LLM configuration into the wrapper repo: the CDK publishes app/llm_provider / app/llm_model, operators keep only the API key path local, and ~/.g3dt/.env is retired.

Resolution model

Setting Resolution
Provider / model --llm-provider / --llm-model flags > SSM app/llm_* > default (anthropic, no model)
API key path --llm-api-key-file > marker llm_api_key_file (g3dt config set llm_api_key_file <path>) > vendor env var (ANTHROPIC_API_KEY/OPENAI_API_KEY)
  • The SSM facts use the existing _app_or_default optional-app-fact mechanism (same contract as the dictionary inputs — not in REQUIRED_APP_KEYS, so pre-llm-block deployments keep working).
  • --llm with no model configured anywhere fails fast with guidance (add the llm block and redeploy, or pass --llm-model) instead of the simulator's .env-era error.
  • The generator script forwards provider/model to gen3-metadata-simulator as CLI flags (the simulator's precedence puts flags above any .env — this is what makes the deployment's values authoritative) and passes --env-file /dev/null to neutralize any stray .env in the caller's CWD.
  • config show prints llm_provider / llm_model / llm_api_key_file; config diff now also compares the optional dictionary and llm inputs when the config file defines them (the dictionary fields were previously invisible to diff).
  • Stale ".env in the working directory" docstrings corrected.

Tests

364/364 green (14 new/updated): moto tests for SSM resolution/defaults/blank-as-unset, script_env export rules, synth flag-override and fail-fast paths, marker isolation, and a stubbed-simulator shell test pinning the flag forwarding and /dev/null neutralizer.

Operator upgrade note

One-time after upgrading: g3dt config set llm_api_key_file ~/.g3dt/anthropic_api_key (any file holding the key). LLM_PROVIDER/LLM_MODEL entries in ~/.g3dt/.env no longer have any effect.

pyproject.toml -> 3.4.0 (minor, backwards-compatible for random-provider and pre-llm-block environments).

The synthetic-data LLM vendor and model now resolve with precedence
CLI flags > SSM > default: the CDK's optional llm config block publishes
app/llm_provider and app/llm_model, so every operator gets the
deployment's values, and new --llm-provider/--llm-model flags on
synth generate/deploy override them for a single run. Environments
deployed without the block fall back to provider anthropic, and the
--llm path fails fast with guidance when no model is configured
anywhere.

Only the API key stays local, as a path: --llm-api-key-file per run, or
set once in the marker via "g3dt config set llm_api_key_file <path>"
(new settable key); the vendor env var remains the simulator's
fallback. The generator script forwards provider/model to
gen3-metadata-simulator as flags (its precedence puts flags above any
.env) and passes --env-file /dev/null so a stray CWD .env can never
hijack resolution -- ~/.g3dt/.env is no longer read.

config show prints the resolved llm facts and key path; config diff now
also compares the optional dictionary and llm inputs when the config
file defines them.
@JoshuaHarris391
JoshuaHarris391 merged commit 36a278c into main Aug 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant