Skip to content

Values from flags should override values in prompt yaml files. #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

phillmv
Copy link
Member

@phillmv phillmv commented May 22, 2025

What?

Very small follow up from #48:

  • If a user supplies a cli flag and a prompt.yaml file, then the value from the flag should override the value from the prompt.yaml file

Why?

Suppose I have a template in a prompt.yaml that defines model parameters (or even model name). If I want to iterate on the temperature, or even which model i want to use then it's easier to do so by repeatedly running the cmd and tweaking the flag value.

Basically, a cli flag has a higher order of "specificity" than the value in the yaml file. I'm more intentional, it is surprising that the cli flag value might be silently ignored.

Bonus observation

About 80% of this test was written via the following prompt:

cb $(ctx show) | ai "add a test suite to for the run_test.go file. the test should ensure that a modelParemeter specified in a prompt.yaml file can be overridden by the values passed in to the command\'s --flags."

@Copilot Copilot AI review requested due to automatic review settings May 22, 2025 20:59
@phillmv phillmv requested a review from a team as a code owner May 22, 2025 20:59
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that CLI flag values take precedence over values defined in prompt YAML files.

  • Reorders flag parsing so that flags override YAML defaults
  • Adds an end-to-end test confirming flags override prompt.yaml parameters

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cmd/run/run.go Moves PopulateFromFlags below YAML-based assignments so flags override
cmd/run/run_test.go Adds a test verifying CLI flags override model and parameter values
Comments suppressed due to low confidence (1)

cmd/run/run_test.go:246

  • [nitpick] The test uses a *.prompt.yaml extension, but the CLI help refers to .prompt.yml—consider unifying the extension in docs and tests for consistency.
tmp, err := os.CreateTemp(t.TempDir(), "*.prompt.yaml")

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy