Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds the ability to load a prompt definition from a YAML file via the --file flag, preload its messages and parameters, and include a test verifying basic YAML loading.
- Introduce
s.prompt.ymlas an example prompt definition. - Parse
.prompt.ymlinto apromptFilestruct inrun.goand inject its data before executing the command. - Add a test in
run_test.goto confirm that YAML-loaded messages and temperature are applied.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| s.prompt.yml | New example YAML file defining prompt metadata. |
| cmd/run/run.go | Parse --file flag, unmarshal YAML, preload messages and parameters. |
| cmd/run/run_test.go | Test that --file loads YAML and applies its settings. |
Comments suppressed due to low confidence (1)
cmd/run/run_test.go:85
- There is no test verifying that a CLI flag overrides a value from the YAML file. Add a case where you pass
--temperaturealongside--fileand assert that the flag value takes effect.
t.Run("--file pre-loads YAML and CLI overrides take precedence", func(t *testing.T) {
b5d7883 to
f74c60a
Compare
Yuzuki-S
approved these changes
May 8, 2025
cheshire137
reviewed
May 8, 2025
| Example: "gh models run openai/gpt-4o-mini \"how many types of hyena are there?\"", | ||
| Args: cobra.ArbitraryArgs, | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| filePath, _ := cmd.Flags().GetString("file") |
Member
There was a problem hiding this comment.
That _, is that an error? Should you maybe check it and return early if it's non-nil?
Collaborator
Author
There was a problem hiding this comment.
Yeah, it's probably wise to do that, but I think it's safe to follow up in a later change. The possible errors here are things like "you defined the file flag as an integer but are trying to GetString it", not really things that users could trigger.
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.
Supports loading prompt from a yml file via the
--fileparameter.