Include initial prompt when interpolating {{input}}
in prompt.yaml files
#47
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.
Hello!
What?
This PR makes it so that the text that is substituted when interpolating
{{input}}
templates inside prompt.yaml files includes whatever got piped in AND the "initial prompt", i.e. the text that is passed in via the positional args.Why?
I am stringing
gh models run
together as a cli util for my own GitHub work related purposes, and I like the idea of having templated system prompts I can swap out at will. I've seen a few people online claim that messing with system prompts is where a lot of the "juice" is, and I find that for ex. the default gpt-4o behaviour is overly verbose and obsequious.Initially, using
--file prompt.yaml
seemed pretty ideal for this. However, I quickly discovered that the{{input}}
template was not being populated with the contents of the "initialPrompt" – only with whatever got piped in.This made it inconvenient to use with my intended use case, i.e. something like this:
Without this change, the specific request to "translate this file into ruby" gets ignored.
Additional improvements
Typing this out, I feel like that this should be the default behaviour, i.e. even if the provided prompt.yaml does not specify an
{{input}}
field but therun
command receives piped or prompted content, then we should throw that in as user message. If I am feeling frisky maybe I could add that in a future PR.