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.providers: block (any OpenAI-compatible endpoint), or the one you pass with
--model / --base-url. Set the key your provider needs.contains/icontains (and
-any/-all), not-contains, equals,
not-equals, starts-with, regex, their not-
forms, is-json (with a schema), and llm-rubric/model-graded
become graded checks. javascript, python, similar and
assert-set are skipped with a warning — add equivalent muteval checks if
your suite relies on them. Output transforms and threshold/weight scoring aren't reproduced
(reported in one warning).{{var}} placeholders in prompts and assertion
values are filled from each test's vars (plus defaultTest vars and
file:// refs; array vars run once per value).