fix(python): fill omitted template variables from prompt input.default - #601
Open
huangjeff5 wants to merge 5 commits into
Open
fix(python): fill omitted template variables from prompt input.default#601huangjeff5 wants to merge 5 commits into
huangjeff5 wants to merge 5 commits into
Conversation
What the aggressive test pass found and fixed: - instance default_model selected config but disappeared from RenderedPrompt.model - compile/call input metadata replaced prompt defaults and schema instead of overlaying - compile metadata used unvalidated model_copy updates - empty model strings could leave model/config inconsistent - plain dict misuse raised an accidental AttributeError instead of a clear TypeError Settled precedence: - defaults: prompt < compile metadata < call metadata < runtime DataArgument.input - model: instance default < prompt < compile metadata < call metadata - config: selected model config < prompt < compile metadata < call metadata - schemas persist through default-only overlays and change only when a later schema is explicit The 24 new product cells cover absent/partial/falsy/shallow runtime input, all four defaults layers, schema preservation/replacement, renderer reuse and caller retention, every model layer, empty models, config composition, and DataArgument enforcement. Verification: - all five reviewers approved after three rounds - 59 focused tests passed - full Python suite: 506 passed, 95% coverage - changed-file Ruff checks and formatting passed - full-repo Ruff/Pyrefly still report only the known pre-existing findings - patch reapplies cleanly to ceb4fc5 and reproduces the exact reviewed tree
File and compile input.default stay on the returned prompt config.
Only this call's options.input.default plus DataArgument.input fill {{name}}.
pavelgj
approved these changes
Sep 10, 2026
input.default in a .prompt file fills any template key the caller left out. Runtime input wins that key.
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.
input.defaultin a.promptfile fills any template key the caller left out. Call defaults overlay the file. Runtime input wins that key.renderandcompiletake aDataArgument, not a plain dict. Model and config layers compose: instance default, then the file, then compile metadata, then the call.Decisions
DataArgument()andDataArgument(input={})are both “no keys supplied.” File defaults fill.None/False/0/'', replaces the default. Nested objects replace; they do not deep-merge.PromptMetadata(input=PromptInputConfig(default=…))overlays the file for those keys. Compile metadata overlays the file; the call overlays compile; runtime input is last.input.defaultmap. That is the same overlay the template used.renderandcompilerequireDataArgument. A mapping isTypeError.default_model, then filemodel:, then compile metadata, then the call. An empty string means absent, not a model named"".model_configsentry, then fileconfig:, then compile, then the call. Later keys overlay.model:is kept on the parsed prompt.