Promptfoo: Test and Red-Team Your LLM Prompts Before Shipping
Promptfoo runs your prompts against multiple models, checks outputs with assertion functions, and red-teams for jailbreaks and PII leakage - all from a YAML config.
Promptfoo is a CLI tool for testing LLM prompts systematically. You write test cases in YAML, define assertions, and Promptfoo runs every prompt against every model in your config - giving you a comparison matrix and a pass/fail report. It also ships a red-teaming engine that automatically probes for safety vulnerabilities.
Installation
npm install -g promptfoo
# or
npx promptfoo@latest
Team workspace
Ship faster with chat, meetings, and projects in one place — Zlyqor.
# promptfooconfig.yaml
providers:
- openai:gpt-4o-mini
- openai:gpt-4o
- ollama:llama3.1:8b
prompts:
- "Summarize the following text in one sentence: {{text}}"
tests:
- vars:
text: "PagedAttention is a memory management technique for LLM inference that treats the KV cache like virtual memory pages."
assert:
- type: contains
value: "KV cache"
- type: javascript
value: "output.length < 200"
- type: llm-rubric
value: "The summary is factually accurate and concise"
Run with:
promptfoo eval
promptfoo view # Open browser UI with comparison table
Model Comparison in PR Checks
Add --ci flag to output JSON results consumable by GitHub Actions:
promptfoo eval --ci --output results.json
Parse results.json in a workflow step to comment score diffs on the PR - your reviewers see exactly which model and which test case regressed.
Custom JavaScript Assertions
For complex validation logic, write a JS function:
Practical deep-dives on LLMs, developer tools, and AI engineering. No filler. Unsubscribe any time.
// written byFIG. AUTH-01
530
Mahmudul Haque Qudrati
CEO & ML Engineer
CEO and ML Engineer at Pristren. Builds AI-powered software for teams and writes about machine learning, LLMs, developer tools, and practical AI applications.
SWE-Bench: The Gold Standard for Evaluating LLM Software Engineering
SWE-Bench tests LLMs on 2,294 real GitHub issues from popular Python repositories, evaluating whether the model can write code that passes the existing test suite - a far harder and more realistic evaluation than HumanEval.