Skip to main content

hackagent.attacks.techniques.static.mml.prompts

Prompt templates for the MML attack.

Contains the textual prompts that accompany the encoded images, instructing the Vision-Language Model to decode and act on the visual content.

Based on the prompt templates from: Wang et al., "Jailbreak Large Vision-Language Models Through Multi-Modal Linkage" (2024) — https://arxiv.org/abs/2412.00473

get_prompt_template​

def get_prompt_template(encoding_mode: str, prompt_style: str) -> str

Retrieve the appropriate prompt template for the given mode and style.

Arguments:

  • encoding_mode - One of "word_replacement", "mirror", "rotate", "base64", "mixed".
  • prompt_style - One of "game", "control".

Returns:

The prompt template string with format placeholders.

Raises:

  • ValueError - If the (encoding_mode, prompt_style) combination is invalid.