muteval 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
muteval/__init__.py ADDED
@@ -0,0 +1,26 @@
1
+ """muteval — mutation testing for LLM eval suites.
2
+
3
+ The question muteval answers is not "do my evals pass?" but
4
+ "would my evals *fail* if my system silently got worse?"
5
+
6
+ It deliberately degrades the thing under test (the prompt today; retrieved
7
+ context and tools tomorrow), reruns your existing eval suite against each
8
+ mutant, and reports the **mutation score**: the fraction of injected
9
+ regressions your evals actually caught. Mutants your evals fail to catch are
10
+ "survivors" — concrete blind spots in your eval coverage.
11
+ """
12
+
13
+ from muteval.config import MutEvalConfig
14
+ from muteval.mutators import Mutant, generate_mutants
15
+ from muteval.runner import MutationResult, run_mutation_testing
16
+
17
+ __version__ = "0.0.1"
18
+
19
+ __all__ = [
20
+ "MutEvalConfig",
21
+ "Mutant",
22
+ "generate_mutants",
23
+ "MutationResult",
24
+ "run_mutation_testing",
25
+ "__version__",
26
+ ]
muteval/cli.py ADDED
@@ -0,0 +1,91 @@
1
+ """Command-line interface: ``muteval run --config path/to/muteval_config.py``."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import sys
7
+ from typing import List, Optional
8
+
9
+ from muteval import __version__
10
+ from muteval.config import load_config
11
+ from muteval.mutators import OPERATORS
12
+ from muteval.report import format_report
13
+ from muteval.runner import run_mutation_testing
14
+
15
+
16
+ def _build_parser() -> argparse.ArgumentParser:
17
+ parser = argparse.ArgumentParser(
18
+ prog="muteval",
19
+ description="Mutation testing for LLM eval suites — measure whether "
20
+ "your evals would actually catch a regression.",
21
+ )
22
+ parser.add_argument("--version", action="version", version=f"muteval {__version__}")
23
+
24
+ sub = parser.add_subparsers(dest="command", required=True)
25
+
26
+ run = sub.add_parser("run", help="Run mutation testing against an eval suite.")
27
+ run.add_argument(
28
+ "--config",
29
+ "-c",
30
+ required=True,
31
+ help="Path to a Python file defining a module-level `config` "
32
+ "(a muteval.MutEvalConfig).",
33
+ )
34
+ run.add_argument(
35
+ "--operators",
36
+ nargs="+",
37
+ choices=list(OPERATORS.keys()),
38
+ default=None,
39
+ help="Subset of mutation operators to use (default: all).",
40
+ )
41
+ run.add_argument(
42
+ "--max-mutants",
43
+ type=int,
44
+ default=None,
45
+ help="Cap the number of mutants (useful for fast/cheap runs).",
46
+ )
47
+ run.add_argument(
48
+ "--fail-under",
49
+ type=float,
50
+ default=None,
51
+ metavar="PCT",
52
+ help="Exit non-zero if the mutation score is below this percent "
53
+ "(e.g. 75). Use this to gate CI.",
54
+ )
55
+ run.add_argument("--no-color", action="store_true", help="Disable ANSI colors.")
56
+ return parser
57
+
58
+
59
+ def main(argv: Optional[List[str]] = None) -> int:
60
+ args = _build_parser().parse_args(argv)
61
+
62
+ if args.command == "run":
63
+ try:
64
+ config = load_config(args.config)
65
+ except (FileNotFoundError, ImportError, TypeError, ValueError) as exc:
66
+ print(f"muteval: error loading config: {exc}", file=sys.stderr)
67
+ return 2
68
+
69
+ result = run_mutation_testing(
70
+ config,
71
+ operators=args.operators,
72
+ max_mutants=args.max_mutants,
73
+ )
74
+ print(format_report(result, use_color=not args.no_color))
75
+
76
+ if args.fail_under is not None:
77
+ score_pct = result.score * 100
78
+ if score_pct < args.fail_under:
79
+ print(
80
+ f"\nmuteval: FAIL — score {score_pct:.0f}% is below "
81
+ f"--fail-under {args.fail_under:.0f}%",
82
+ file=sys.stderr,
83
+ )
84
+ return 1
85
+ return 0
86
+
87
+ return 2
88
+
89
+
90
+ if __name__ == "__main__":
91
+ raise SystemExit(main())
muteval/config.py ADDED
@@ -0,0 +1,73 @@
1
+ """Configuration object that a user defines to describe their system + evals."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import importlib.util
6
+ import sys
7
+ from dataclasses import dataclass, field
8
+ from pathlib import Path
9
+ from typing import Any, Callable, List
10
+
11
+ # A function that runs the system under test: (prompt, case) -> output_text
12
+ RunFn = Callable[[str, Any], str]
13
+
14
+ # A single eval/check: (output_text, case) -> True if it PASSES, False if it fails.
15
+ EvalFn = Callable[[str, Any], bool]
16
+
17
+
18
+ @dataclass
19
+ class MutEvalConfig:
20
+ """Everything muteval needs to grade an eval suite.
21
+
22
+ Attributes:
23
+ prompt: The system prompt (the thing under test) as a string.
24
+ cases: Inputs fed to the system. Each element is passed to ``run`` and
25
+ to every eval. Can be anything (str, dict, dataclass...).
26
+ run: ``run(prompt, case) -> output``. Calls your model/app with the
27
+ (possibly mutated) prompt and returns the text output.
28
+ evals: List of checks. Each is ``eval(output, case) -> bool`` where
29
+ True means the check passed. These are the evals being graded.
30
+ runs_per_mutant: How many times to evaluate each mutant. >1 helps with
31
+ non-deterministic systems. A mutant is "killed" if the suite fails
32
+ on *any* run (i.e. the evals managed to detect the degradation).
33
+ eval_names: Optional human labels for evals, used in reports.
34
+ """
35
+
36
+ prompt: str
37
+ cases: List[Any]
38
+ run: RunFn
39
+ evals: List[EvalFn]
40
+ runs_per_mutant: int = 1
41
+ eval_names: List[str] = field(default_factory=list)
42
+
43
+ def __post_init__(self) -> None:
44
+ if not isinstance(self.prompt, str) or not self.prompt.strip():
45
+ raise ValueError("config.prompt must be a non-empty string")
46
+ if not self.cases:
47
+ raise ValueError("config.cases must contain at least one case")
48
+ if not self.evals:
49
+ raise ValueError("config.evals must contain at least one eval")
50
+ if self.runs_per_mutant < 1:
51
+ raise ValueError("config.runs_per_mutant must be >= 1")
52
+
53
+
54
+ def load_config(path: str | Path) -> MutEvalConfig:
55
+ """Load a ``MutEvalConfig`` from a Python file that defines ``config``."""
56
+ path = Path(path).resolve()
57
+ if not path.exists():
58
+ raise FileNotFoundError(f"Config file not found: {path}")
59
+
60
+ spec = importlib.util.spec_from_file_location("muteval_user_config", path)
61
+ if spec is None or spec.loader is None:
62
+ raise ImportError(f"Could not load config module from {path}")
63
+ module = importlib.util.module_from_spec(spec)
64
+ sys.modules["muteval_user_config"] = module
65
+ spec.loader.exec_module(module)
66
+
67
+ config = getattr(module, "config", None)
68
+ if not isinstance(config, MutEvalConfig):
69
+ raise TypeError(
70
+ f"{path} must define a module-level variable `config` of type "
71
+ f"MutEvalConfig (found: {type(config).__name__})"
72
+ )
73
+ return config
muteval/mutators.py ADDED
@@ -0,0 +1,169 @@
1
+ """Mutation operators.
2
+
3
+ Each operator takes the original prompt and yields zero or more ``Mutant``s —
4
+ a deliberately degraded version of the prompt plus a human description of what
5
+ was broken. The runner then checks whether the user's eval suite catches the
6
+ degradation.
7
+
8
+ v0 operators are rule-based and deterministic (given a seed) so results are
9
+ reproducible and require no API calls to generate. LLM-driven semantic
10
+ mutations and non-prompt targets (retrieved context, tool outputs) are on the
11
+ roadmap — see ROADMAP in the README.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import re
17
+ from dataclasses import dataclass
18
+ from typing import Callable, Dict, List
19
+
20
+
21
+ @dataclass(frozen=True)
22
+ class Mutant:
23
+ """A single degraded version of the prompt."""
24
+
25
+ operator: str # which mutation operator produced this
26
+ description: str # human-readable "what was broken"
27
+ prompt: str # the mutated prompt text
28
+
29
+
30
+ # --- Operators ---------------------------------------------------------------
31
+
32
+ # Pairs of (strong -> weak) wordings. Case-insensitive, whole-word matches.
33
+ _MODAL_WEAKENINGS = [
34
+ ("must not", "should avoid"),
35
+ ("must", "should"),
36
+ ("never", "rarely"),
37
+ ("always", "usually"),
38
+ ("required", "optional"),
39
+ ("do not", "try not to"),
40
+ ("don't", "try not to"),
41
+ ("strictly", "ideally"),
42
+ ("ensure", "consider"),
43
+ ("only", "preferably"),
44
+ ]
45
+
46
+
47
+ def weaken_modals(prompt: str) -> List[Mutant]:
48
+ """Soften strong instructions (MUST -> should, never -> rarely, ...).
49
+
50
+ Each replaceable occurrence becomes its own mutant so a single missed
51
+ instruction is isolated.
52
+ """
53
+ mutants: List[Mutant] = []
54
+ for strong, weak in _MODAL_WEAKENINGS:
55
+ pattern = re.compile(rf"\b{re.escape(strong)}\b", re.IGNORECASE)
56
+ for match in pattern.finditer(prompt):
57
+ start, end = match.span()
58
+ mutated = prompt[:start] + weak + prompt[end:]
59
+ snippet = _context_snippet(prompt, start, end)
60
+ mutants.append(
61
+ Mutant(
62
+ operator="weaken_modals",
63
+ description=f'weakened "{match.group(0)}" -> "{weak}" (near: {snippet})',
64
+ prompt=mutated,
65
+ )
66
+ )
67
+ return mutants
68
+
69
+
70
+ def drop_instruction_lines(prompt: str) -> List[Mutant]:
71
+ """Delete a single instruction line/bullet at a time.
72
+
73
+ Models "someone trimmed the prompt and silently removed a capability."
74
+ """
75
+ lines = prompt.splitlines()
76
+ mutants: List[Mutant] = []
77
+ for i, line in enumerate(lines):
78
+ stripped = line.strip()
79
+ if not _is_instruction_line(stripped):
80
+ continue
81
+ remaining = lines[:i] + lines[i + 1 :]
82
+ mutated = "\n".join(remaining)
83
+ mutants.append(
84
+ Mutant(
85
+ operator="drop_instruction_lines",
86
+ description=f'dropped line: "{_truncate(stripped)}"',
87
+ prompt=mutated,
88
+ )
89
+ )
90
+ return mutants
91
+
92
+
93
+ def delete_sentences(prompt: str) -> List[Mutant]:
94
+ """Delete a single sentence at a time (for prose-style prompts)."""
95
+ sentences = _split_sentences(prompt)
96
+ if len(sentences) < 2:
97
+ return []
98
+ mutants: List[Mutant] = []
99
+ for i, sentence in enumerate(sentences):
100
+ if len(sentence.strip()) < 12:
101
+ continue
102
+ remaining = sentences[:i] + sentences[i + 1 :]
103
+ mutated = " ".join(s.strip() for s in remaining).strip()
104
+ mutants.append(
105
+ Mutant(
106
+ operator="delete_sentences",
107
+ description=f'deleted sentence: "{_truncate(sentence.strip())}"',
108
+ prompt=mutated,
109
+ )
110
+ )
111
+ return mutants
112
+
113
+
114
+ # Registry of all operators. Keyed by name so they can be selected/filtered.
115
+ OPERATORS: Dict[str, Callable[[str], List[Mutant]]] = {
116
+ "weaken_modals": weaken_modals,
117
+ "drop_instruction_lines": drop_instruction_lines,
118
+ "delete_sentences": delete_sentences,
119
+ }
120
+
121
+
122
+ def generate_mutants(
123
+ prompt: str,
124
+ operators: List[str] | None = None,
125
+ ) -> List[Mutant]:
126
+ """Run the selected operators and return a de-duplicated list of mutants."""
127
+ selected = operators or list(OPERATORS.keys())
128
+ seen = set()
129
+ mutants: List[Mutant] = []
130
+ for name in selected:
131
+ op = OPERATORS.get(name)
132
+ if op is None:
133
+ raise ValueError(
134
+ f"Unknown operator '{name}'. Available: {list(OPERATORS)}"
135
+ )
136
+ for mutant in op(prompt):
137
+ # Skip no-ops and exact-duplicate prompts.
138
+ if mutant.prompt == prompt or mutant.prompt in seen:
139
+ continue
140
+ seen.add(mutant.prompt)
141
+ mutants.append(mutant)
142
+ return mutants
143
+
144
+
145
+ # --- helpers -----------------------------------------------------------------
146
+
147
+
148
+ def _is_instruction_line(stripped: str) -> bool:
149
+ if len(stripped) < 8:
150
+ return False
151
+ bullet = re.match(r"^([-*+]|\d+[.)])\s+", stripped)
152
+ return bool(bullet) or stripped.endswith((".", ":", "!"))
153
+
154
+
155
+ def _split_sentences(text: str) -> List[str]:
156
+ parts = re.split(r"(?<=[.!?])\s+", text.replace("\n", " "))
157
+ return [p for p in parts if p.strip()]
158
+
159
+
160
+ def _context_snippet(text: str, start: int, end: int, width: int = 24) -> str:
161
+ left = max(0, start - width)
162
+ right = min(len(text), end + width)
163
+ snippet = text[left:right].replace("\n", " ").strip()
164
+ return _truncate(snippet, 60)
165
+
166
+
167
+ def _truncate(text: str, limit: int = 70) -> str:
168
+ text = " ".join(text.split())
169
+ return text if len(text) <= limit else text[: limit - 1] + "…"
muteval/report.py ADDED
@@ -0,0 +1,67 @@
1
+ """Human-readable terminal reporting for a MutationResult."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from muteval.runner import MutationResult
6
+
7
+
8
+ def _bar(score: float, width: int = 24) -> str:
9
+ filled = int(round(score * width))
10
+ return "█" * filled + "░" * (width - filled)
11
+
12
+
13
+ def format_report(result: MutationResult, use_color: bool = True) -> str:
14
+ def c(text: str, code: str) -> str:
15
+ return f"\033[{code}m{text}\033[0m" if use_color else text
16
+
17
+ lines = []
18
+ lines.append("")
19
+ lines.append(c("muteval — mutation testing for your eval suite", "1"))
20
+ lines.append("")
21
+
22
+ if not result.baseline_passed:
23
+ lines.append(
24
+ c(
25
+ "⚠ Baseline FAILED: your eval suite does not pass on the "
26
+ "original prompt.",
27
+ "33",
28
+ )
29
+ )
30
+ lines.append(
31
+ " Fix your evals/system so the baseline is green before trusting "
32
+ "the score below."
33
+ )
34
+ lines.append("")
35
+
36
+ if result.total == 0:
37
+ lines.append("No mutants were generated. Is your prompt long enough?")
38
+ return "\n".join(lines)
39
+
40
+ pct = result.score * 100
41
+ score_color = "32" if pct >= 80 else "33" if pct >= 50 else "31"
42
+ lines.append(
43
+ f"Mutation score: {c(f'{pct:.0f}%', score_color)} "
44
+ f"[{_bar(result.score)}] "
45
+ f"({result.killed}/{result.total} mutants killed)"
46
+ )
47
+ lines.append("")
48
+
49
+ survivors = result.survivors
50
+ if not survivors:
51
+ lines.append(c("✓ No survivors — your evals caught every injected regression.", "32"))
52
+ return "\n".join(lines)
53
+
54
+ lines.append(
55
+ c(f"{len(survivors)} SURVIVED", "31")
56
+ + " (these regressions slipped past your evals — coverage gaps):"
57
+ )
58
+ lines.append("")
59
+ for o in survivors:
60
+ lines.append(f" {c('SURVIVED', '31')} [{o.mutant.operator}]")
61
+ lines.append(f" {o.mutant.description}")
62
+ lines.append("")
63
+ lines.append(
64
+ "Each survivor is a change to your system your evals would NOT notice. "
65
+ "Write an eval that fails on it, then re-run."
66
+ )
67
+ return "\n".join(lines)
muteval/runner.py ADDED
@@ -0,0 +1,108 @@
1
+ """The mutation-testing engine.
2
+
3
+ Flow:
4
+ 1. Establish a baseline: the eval suite must PASS on the original prompt.
5
+ (If it doesn't, mutation results are meaningless — you have failing evals
6
+ before we even break anything.)
7
+ 2. For each mutant, run the eval suite. The mutant is "killed" if the suite
8
+ FAILS (your evals detected the degradation) and "survives" if it still
9
+ PASSES (a blind spot in your evals).
10
+ 3. Mutation score = killed / total mutants. Higher is better.
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ from dataclasses import dataclass, field
16
+ from typing import List, Optional
17
+
18
+ from muteval.config import MutEvalConfig
19
+ from muteval.mutators import Mutant, generate_mutants
20
+
21
+
22
+ @dataclass
23
+ class MutantOutcome:
24
+ mutant: Mutant
25
+ killed: bool
26
+ failing_eval: Optional[str] = None # which eval caught it (first failure)
27
+
28
+
29
+ @dataclass
30
+ class MutationResult:
31
+ baseline_passed: bool
32
+ outcomes: List[MutantOutcome] = field(default_factory=list)
33
+
34
+ @property
35
+ def total(self) -> int:
36
+ return len(self.outcomes)
37
+
38
+ @property
39
+ def killed(self) -> int:
40
+ return sum(1 for o in self.outcomes if o.killed)
41
+
42
+ @property
43
+ def survivors(self) -> List[MutantOutcome]:
44
+ return [o for o in self.outcomes if not o.killed]
45
+
46
+ @property
47
+ def score(self) -> float:
48
+ """Mutation score in [0, 1]. Returns 1.0 if there were no mutants."""
49
+ if not self.outcomes:
50
+ return 1.0
51
+ return self.killed / self.total
52
+
53
+
54
+ def _suite_outcome(prompt: str, config: MutEvalConfig) -> Optional[str]:
55
+ """Run the eval suite once over all cases.
56
+
57
+ Returns None if the whole suite passes, or the name of the first failing
58
+ eval if anything fails.
59
+ """
60
+ for case in config.cases:
61
+ output = config.run(prompt, case)
62
+ for idx, ev in enumerate(config.evals):
63
+ if not ev(output, case):
64
+ return _eval_label(config, idx)
65
+ return None
66
+
67
+
68
+ def _suite_passes(prompt: str, config: MutEvalConfig) -> bool:
69
+ return _suite_outcome(prompt, config) is None
70
+
71
+
72
+ def _eval_label(config: MutEvalConfig, idx: int) -> str:
73
+ if idx < len(config.eval_names):
74
+ return config.eval_names[idx]
75
+ ev = config.evals[idx]
76
+ return getattr(ev, "__name__", f"eval[{idx}]")
77
+
78
+
79
+ def run_mutation_testing(
80
+ config: MutEvalConfig,
81
+ operators: List[str] | None = None,
82
+ max_mutants: Optional[int] = None,
83
+ ) -> MutationResult:
84
+ """Run mutation testing for the given config and return a MutationResult."""
85
+ baseline_passed = _suite_passes(config.prompt, config)
86
+
87
+ mutants = generate_mutants(config.prompt, operators=operators)
88
+ if max_mutants is not None:
89
+ mutants = mutants[:max_mutants]
90
+
91
+ result = MutationResult(baseline_passed=baseline_passed)
92
+
93
+ for mutant in mutants:
94
+ # A mutant is killed if the suite fails on ANY of runs_per_mutant runs.
95
+ failing_eval: Optional[str] = None
96
+ for _ in range(config.runs_per_mutant):
97
+ failing_eval = _suite_outcome(mutant.prompt, config)
98
+ if failing_eval is not None:
99
+ break
100
+ result.outcomes.append(
101
+ MutantOutcome(
102
+ mutant=mutant,
103
+ killed=failing_eval is not None,
104
+ failing_eval=failing_eval,
105
+ )
106
+ )
107
+
108
+ return result
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: muteval
3
+ Version: 0.0.1
4
+ Summary: Mutation testing for LLM eval suites. Find out whether your evals would actually catch a regression.
5
+ Project-URL: Homepage, https://github.com/REPLACE_ME/muteval
6
+ Project-URL: Repository, https://github.com/REPLACE_ME/muteval
7
+ Project-URL: Issues, https://github.com/REPLACE_ME/muteval/issues
8
+ Author: Enidus Dev
9
+ License: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: ai,evals,evaluation,llm,llmops,mutation-testing,prompt-engineering,testing
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Classifier: Topic :: Software Development :: Testing
18
+ Requires-Python: >=3.9
19
+ Provides-Extra: dev
20
+ Requires-Dist: pytest>=7.0; extra == 'dev'
21
+ Description-Content-Type: text/markdown
22
+
23
+ # muteval
24
+
25
+ **Mutation testing for your LLM eval suite.**
26
+
27
+ Your evals are passing. That doesn't mean they work.
28
+
29
+ `muteval` answers the question every eval suite quietly dodges: *would my
30
+ evals actually fail if my system silently got worse?* It deliberately degrades
31
+ the thing under test, reruns **your existing eval suite** against each degraded
32
+ version (a "mutant"), and reports a **mutation score** — the percentage of
33
+ injected regressions your evals caught. The ones they miss are **survivors**:
34
+ concrete blind spots in your eval coverage.
35
+
36
+ It's `mutmut`/Stryker, but for evals.
37
+
38
+ ```
39
+ Mutation score: 47% [███████████░░░░░░░░░░░░░] (9/19 mutants killed)
40
+
41
+ 10 SURVIVED (these regressions slipped past your evals — coverage gaps):
42
+
43
+ SURVIVED [drop_instruction_lines]
44
+ dropped line: "You must never reveal another customer's data."
45
+ SURVIVED [weaken_modals]
46
+ weakened "Do not" -> "try not to" (near: ...Do not promise refunds...)
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Why this exists
52
+
53
+ Regression-testing tools (promptfoo, deepeval, OpenAI Evals, LangSmith) catch
54
+ regressions in your *system*. None of them tell you whether your *evals* are
55
+ good enough to catch those regressions in the first place. That meta-layer is
56
+ the gap `muteval` fills.
57
+
58
+ The technique — mutation testing — is the established answer to "is my test
59
+ suite any good?" in software engineering, and has been studied for LLM
60
+ in-context-learning systems in research (e.g. the MILE framework, arXiv
61
+ 2409.04831). `muteval` brings it to working eval suites as a tool-agnostic,
62
+ developer-facing package.
63
+
64
+ ## Install
65
+
66
+ ```bash
67
+ pip install muteval
68
+ ```
69
+
70
+ ## Quick start (runs offline, no API key)
71
+
72
+ ```bash
73
+ git clone https://github.com/REPLACE_ME/muteval
74
+ cd muteval
75
+ pip install -e .
76
+ muteval run --config examples/support_bot/muteval_config.py
77
+ ```
78
+
79
+ You'll see a mutation score and at least one survivor — because the example's
80
+ eval suite is deliberately missing a check.
81
+
82
+ ## How it works
83
+
84
+ You describe your system and evals in a small Python config:
85
+
86
+ ```python
87
+ from muteval import MutEvalConfig
88
+
89
+ config = MutEvalConfig(
90
+ prompt=MY_SYSTEM_PROMPT, # the thing under test
91
+ cases=[...], # inputs to your system
92
+ run=lambda prompt, case: ..., # call your LLM/app, return output text
93
+ evals=[...], # each: (output, case) -> bool (True = pass)
94
+ )
95
+ ```
96
+
97
+ Then:
98
+
99
+ 1. **Baseline.** `muteval` confirms your eval suite passes on the original
100
+ prompt. (If it doesn't, the score is meaningless — fix that first.)
101
+ 2. **Mutate.** It generates mutants by degrading the prompt — weakening strong
102
+ instructions (`must` → `should`), dropping instruction lines, deleting
103
+ sentences.
104
+ 3. **Grade.** It reruns your eval suite against each mutant. A mutant is
105
+ **killed** if your evals fail (good — they caught it) and **survives** if
106
+ they still pass (bad — a gap).
107
+ 4. **Score.** `killed / total`. Write evals to kill the survivors, and watch
108
+ the number climb.
109
+
110
+ ## Gate CI
111
+
112
+ ```bash
113
+ muteval run --config muteval_config.py --fail-under 75
114
+ ```
115
+
116
+ Exits non-zero if your eval coverage drops below 75%, so a PR that weakens your
117
+ evals fails the build.
118
+
119
+ ## Roadmap
120
+
121
+ `muteval` v0 mutates **prompts**. The thesis scales well beyond that:
122
+
123
+ - [ ] LLM-driven semantic mutations (beyond rule-based string edits)
124
+ - [ ] Mutate **retrieved context** (RAG) — corrupt/swap/drop retrieved docs
125
+ - [ ] Mutate **tool outputs** for agent eval suites
126
+ - [ ] Model-swap mutants (downgrade the model, see if evals notice)
127
+ - [ ] Adapters for promptfoo / deepeval test definitions
128
+ - [ ] Statistical handling for non-deterministic suites (confidence intervals)
129
+ - [ ] HTML / Markdown reports and a shareable score badge
130
+
131
+ The endgame is the standard way teams *certify* their evals before trusting an
132
+ AI system in production.
133
+
134
+ ## Contributing
135
+
136
+ This is an early, open project and contributions are very welcome — especially
137
+ new mutation operators and tool adapters. See [CONTRIBUTING.md](CONTRIBUTING.md).
138
+
139
+ ## License
140
+
141
+ [Apache-2.0](LICENSE).
@@ -0,0 +1,11 @@
1
+ muteval/__init__.py,sha256=oPm6HLlBRdngtPsSqf1xGD3-UnvL2-rtvHiY6NlwWc4,857
2
+ muteval/cli.py,sha256=5xjEsSRtJj7B7yNCAo7X4u8po_8H4bjBrNQKVx8h2vs,2804
3
+ muteval/config.py,sha256=737sJJwx6RUpnbTwlvoX30NSbeXZZEu_BJW33XZE8_s,2947
4
+ muteval/mutators.py,sha256=KwS8NPrjkbfSC0Dqq-xCbyZPngbddziT-Se_qafRZF0,5559
5
+ muteval/report.py,sha256=qF0A1RAlMGhbHSyY9z5KyMtOJmfUK0YUb9sHMcbsp2o,2162
6
+ muteval/runner.py,sha256=vfO7mJB7zhnitdEs_1K66cafBSa8_1hyNiUb2ifTDFo,3327
7
+ muteval-0.0.1.dist-info/METADATA,sha256=_MHVp7T3OtOEluShVL-z1XHBdxzRr6NzFaZKcfGmaf8,5027
8
+ muteval-0.0.1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
9
+ muteval-0.0.1.dist-info/entry_points.txt,sha256=YVvq_KmNiSJDpR1OlDLw1cuugF54QND4nXqKl34x7Qw,45
10
+ muteval-0.0.1.dist-info/licenses/LICENSE,sha256=OeiPVGERMWwyppp0I7plSITlTdD2yUAXbRsPHIG4O_k,11340
11
+ muteval-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ muteval = muteval.cli:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Enidus Dev
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.