feat: resolve synth LLM provider/model from SSM; retire ~/.g3dt/.env - #11
Merged
Conversation
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.
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.
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/.envis retired.Resolution model
--llm-provider/--llm-modelflags > SSMapp/llm_*> default (anthropic, no model)--llm-api-key-file> markerllm_api_key_file(g3dt config set llm_api_key_file <path>) > vendor env var (ANTHROPIC_API_KEY/OPENAI_API_KEY)_app_or_defaultoptional-app-fact mechanism (same contract as the dictionary inputs — not inREQUIRED_APP_KEYS, so pre-llm-block deployments keep working).--llmwith 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..env— this is what makes the deployment's values authoritative) and passes--env-file /dev/nullto neutralize any stray.envin the caller's CWD.config showprintsllm_provider/llm_model/llm_api_key_file;config diffnow also compares the optional dictionary and llm inputs when the config file defines them (the dictionary fields were previously invisible to diff).Tests
364/364 green (14 new/updated): moto tests for SSM resolution/defaults/blank-as-unset,
script_envexport rules, synth flag-override and fail-fast paths, marker isolation, and a stubbed-simulator shell test pinning the flag forwarding and/dev/nullneutralizer.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_MODELentries in~/.g3dt/.envno longer have any effect.pyproject.toml-> 3.4.0 (minor, backwards-compatible for random-provider and pre-llm-block environments).