Generates attacks targeting policy violations.
Inspired by promptfoo's policy plugin. Takes a free-form policy text
describing what the assistant must or must not do, plus a purpose
describing the assistant's domain. The attacker LLM produces adversarial
user messages that probe rules in the policy, framed for the assistant's
domain so they read as plausible user turns rather than obvious adversarial
probes.
Each generated case carries the policy text in expected.policy_violation,
so the Tribunal.Judges.PolicyViolation judge grades responses against the
same constraint set at run time.
Options
:purpose— required. Free-form description of the assistant's domain.:policy— required. The policy text the assistant must follow.:count— number of attacks to generate. Defaults to5.:attacker— module implementingTribunal.RedTeam.Attacker. Defaults toTribunal.RedTeam.Attacker.default/0.:model— passed through to the attacker.:temperature,:max_tokens— passed through to the attacker.
Example
{:ok, cases} = Tribunal.RedTeam.Plugins.Policy.generate(
purpose: "Shopping assistant for a cosmetics retailer.",
policy: "Never give medical or financial advice. Stay on topic.",
count: 5
)