muteval · promptfoo example
Install, point it at your promptfooconfig.yaml, and read the two reports
it writes. The example below runs against a public promptfoo suite
(adelmuursepp/promptfoo-demo-evals);
you'd point it at your own.
Pure-Python core; the [promptfoo] extra only adds a YAML parser. No key needed to install.
pip install "muteval[promptfoo]" export OPENAI_API_KEY=sk-... # muteval runs your prompt on a model; set your provider's key
muteval reads any promptfooconfig.yaml directly — the prompt becomes the
mutation target, each test a case, each assertion a graded check. This example uses a language-tutor
feedback prompt; swap in your own config and the flow is identical.
You are a friendly language tutor.
Based on the following grading in {{language}}, provide constructive feedback to the
student in English so they can improve in learning the language.
If the mark is 10, just say the user did a great work. Do not use markdown for the
feedback message. The feedback should be concise and direct.
Return JSON with a single key 'feedback_message' containing the message.
muteval generates mutants of the prompt, reruns the promptfoo suite against each, and scores how many the assertions caught — then writes the two HTML reports.
muteval run --promptfoo promptfooconfig.yaml muteval report --html coverage.html muteval probe --promptfoo promptfooconfig.yaml --html quality.html
Would the suite notice if the prompt silently degraded? For 11 of 15 injected regressions: no.
feedback_message key — caught by is-json / contains.Coverage asks "would the suite catch a regression?" The quality card audits the suite itself, ranked by what each lens actually catches.
muteval label emits a worksheet to enable it.muteval is a per-suite diagnostic: it shows where a suite has holes and names the fix. See the limits →
Swap the example for your own suite. A few things to set, depending on how yours is built:
promptfooconfig.yaml with the path to yours. If it
defines several prompts, muteval mutates the first — split them into separate configs to cover each.gpt-4o-mini). Set the key your provider needs; to use a different model, load the config
in a two-line .py and pass from_promptfoo(path, model="…").contains, icontains,
not-contains, equals, regex, and
llm-rubric/model-graded become graded checks. is-json,
javascript, and python asserts are skipped — if your suite relies on those,
add the equivalent muteval checks so they're graded too.{{var}} placeholders are filled from each test's
vars, so your existing cases carry over unchanged.