Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions assayer/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ def run(
timeout: float,
) -> None:
if prompt_file:
if prompt:
click.echo(
"Warning: --prompt-file takes precedence; "
"the inline prompt is ignored.",
err=True,
)
with open(prompt_file) as f:
prompt_text = f.read().strip()
elif prompt:
Expand Down
24 changes: 24 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,30 @@ def test_run_var_missing_template_key_exits_with_error():
assert "missing" in result.output


def test_run_warns_when_prompt_and_prompt_file_are_both_supplied(tmp_path):
prompt_file = tmp_path / "prompt.txt"
prompt_file.write_text("prompt from file")

result = CliRunner().invoke(
cli,
[
"run",
"inline prompt",
"--prompt-file",
str(prompt_file),
"--models",
"gpt-4o",
"--var",
"BADFORMAT",
],
)

assert (
"Warning: --prompt-file takes precedence; the inline prompt is ignored."
in result.output
)


# ---------------------------------------------------------------------------
# run — successful flow
# ---------------------------------------------------------------------------
Expand Down
Loading