Skip to content

Customizing Dimensions

The pages in this section represent the auto-generated source code for every built-in Dimension in the Mutant library.

Because these pages pull directly from the Python source code, you can click "Show Source" on any dimension (like AngryCustomerDimension) to read the exact LLM prompt instructions that Mutant uses under the hood.

How to Customize a Prompt

If you want to tweak the prompt for a specific dimension to better suit your needs, you can easily subclass it and override the get_mutation_instructions() method.

Here is a copy-pasteable example of looking at the reference for AngryCustomerDimension, deciding it isn't angry enough, and overriding its prompt:

from mutant.dimensions.emotion import AngryCustomerDimension
from mutant.core.registry import registry
from mutant.core.engine import augment

# 1. Subclass the specific dimension you want to change
class ExtremelyAngryCustomerDimension(AngryCustomerDimension):

    # Optional: You can change the ID if you want, 
    # or keep it the same to overwrite the default!
    id = "emotion.extremely_angry"

    # 2. Override the prompt instructions
    def get_mutation_instructions(self) -> str:
        return (
            "Rewrite the scenario from the perspective of a customer who is "
            "ABSOLUTELY LIVID. They should use all caps, swear words, and "
            "threaten to sue the company immediately. Hold nothing back."
        )

# 3. Register your custom dimension
registry.register(ExtremelyAngryCustomerDimension())

# 4. Use it!
dataset = await augment(
    dataset=[scenario],
    provider=provider,
    dimensions=["emotion.extremely_angry"]
)

[!TIP] Pro-Tip: If you keep the id identical to the built-in dimension (e.g., id = "emotion.angry"), you must first unregister the default one using registry.unregister("emotion.angry") before registering your custom version.