Prompt Testing CLI Template¶
This document outlines a reusable command-line harness for quickly experimenting with prompts against language models. The goal is to standardize how you submit prompts, capture responses, and log results for later review.
Objectives¶
- Quick iteration – Swap in different prompts and models without modifying code.
- Consistent logging – Save all interactions to timestamped log files for analysis.
- Extensible – Provide a foundation you can build on with additional features like batch testing or automated comparisons.
Setup¶
- Create a new Python environment using
venvorconda. - Install dependencies:
pip install openai rich yaml - Scaffold the following files:
prompt_harness.py– main script to run prompts from the CLI.prompts.yaml– list of prompts and parameters to test.README.md– usage guide.
Basic Flow¶
flowchart TD
Start(["Run prompt_harness.py"]) --> LoadPrompts{{"Read prompts.yaml"}}
LoadPrompts --> Send["Send prompt to model"]
Send --> Record["Capture model response"]
Record --> Log["Write prompt & response to log file"]
Log --> End(["Exit"])
Example prompts.yaml¶
model: "gpt-3.5-turbo"
prompts:
- text: "Summarize the meeting notes"
- text: "Generate a list of creative taglines for a coffee shop"
options:
max_tokens: 150
temperature: 0.7
Deliverables¶
- Working
prompt_harness.pythat reads prompts fromprompts.yamland prints the model's responses. - Example log file showing at least two prompts and their outputs.
- Updated
README.mddocumenting configuration and how to add new prompts or change models.
Submission¶
Push your implementation to the repository and open a pull request. Include sample output from your log file. Note any limitations or ideas for future improvements in the PR description.