Loading...
Loading...
Write, refine, run, and QA promptfoo evaluation suites: promptfooconfig.yaml, prompts, providers, vars, tests, assertions, model-graded rubrics, transforms, datasets, exports, and CI gates. Use for non-redteam eval coverage, regression tests, or new eval matrices. Do not use for adversarial redteam plugin or strategy setup.
npx skill4agent add promptfoo/promptfoo promptfoo-evalsreferences/cheatsheet.mdpromptfooconfig.yamlpromptfooconfig.ymlpromptfooevalsevals/<suite-name>/
promptfooconfig.yaml
prompts/
tests/# yaml-language-server: $schema=https://promptfoo.dev/config-schema.jsonprompts/*.txtprompts/*.jsonfile://prompts/main.txt{{variable}}| Scenario | Provider pattern |
|---|---|
| Compare models | |
| Test an HTTP API | |
| Test local code | |
| Echo/passthrough | |
response_formatconfig:
temperature: 0
response_format:
type: json_objecttests: file://tests/*.yamltests: file://tests.csv
# or
tests: file://generate_tests.py:create_testsdescriptionvarsassertequalscontainsicontainsregexis-jsoncontains-jsonstarts-withcostlatencyjavascriptpythonllm-rubricfactualityanswer-relevancecontext-faithfulnessweightmetricthresholdcostlatencydefaultTest:
options:
provider: openai:gpt-5-mini
tests:
- description: 'Model-graded quality check'
assert:
- type: llm-rubric
value: 'Accurate and concise'
# Optional per-assertion override:
# provider: anthropic:messages:claude-sonnet-4-6context-faithfulnessllm-rubricassert:
- type: llm-rubric
value: |
The summary only states facts from this source article:
"{{article}}"
It does not add, infer, or fabricate any claims.assert:
- type: is-json
value: # optional JSON Schema
type: object
required: [name, score]
- type: javascript
value: 'JSON.parse(output).score >= 0.8'options.transformoptions:
transform: "output.replace(/```json\\n?|```/g, '').trim()"defaultTest--no-cachenpx promptfoo@latest validate config -c <config>
npx promptfoo@latest eval -c <config> -o output.json --no-cache --no-share-o output.jsonsuccessscoreerrorsource ~/.nvm/nvm.sh && nvm use
npm run local -- validate config -c <config>
npm run local -- eval -c <config> -o output.json --no-cache --no-share--env-file .envnpm run local -- view# ❌ WRONG — shell-style env vars don't work in YAML configs
apiKey: $OPENAI_API_KEY
# ✅ CORRECT — use Nunjucks syntax with quotes
apiKey: '{{env.OPENAI_API_KEY}}'# ❌ WRONG — rubric references "the article" but grader can't see it
- type: llm-rubric
value: 'Only contains info from the original article'
# ✅ CORRECT — inline the source so the grader can compare
- type: llm-rubric
value: |
Only states facts from: "{{article}}"