Skip to content

Plugin System

Mutant is designed to be highly extensible. The Plugin System allows you to register custom operators and dimensions to tailor the dataset generation to your specific domain needs.

The MutationRegistry

The central hub for plugins is the MutationRegistry. All built-in operators are registered here by default, but you can easily add your own.

Creating a Custom Operator

To create a custom operator, you subclass the MutationDimension base class and define your specific operators.

from mutant.dimensions.base import MutationDimension, DimensionCategory, DimensionSeverity

class DomainSpecificDimension(MutationDimension):
    id = "domain_specific"
    name = "Domain Specific"
    category = DimensionCategory.KNOWLEDGE
    severity = DimensionSeverity.MEDIUM
    description = "Tests domain specific knowledge."

    def get_operators(self):
        return [
            "Jargon Injection: Replace common terms with industry-specific jargon.",
            "Edge Case Constraint: Introduce a rare domain constraint."
        ]

Registering Your Plugin

Once defined, you register it with the engine:

from mutant.core.registry import registry

registry.register(DomainSpecificDimension())
The MutationEngine will now consider your custom operators during the mutation planning stage!