pyrit.models.SeedAttackTechniqueGroup#

class SeedAttackTechniqueGroup(*, seeds: Sequence[Seed | dict[str, Any]])[source]#

Bases: SeedGroup

A group of seeds representing a general attack technique.

This class extends SeedGroup with technique-specific validation: - Requires all seeds to have is_general_technique=True

All other functionality (simulated conversation, prepended conversation, next_message, etc.) is inherited from SeedGroup.

__init__(*, seeds: Sequence[Seed | dict[str, Any]])[source]#

Initialize a SeedAttackTechniqueGroup.

Parameters:

seeds – Sequence of seeds. All seeds must have is_general_technique=True.

Raises:
  • ValueError – If seeds is empty.

  • ValueError – If any seed does not have is_general_technique=True.

Methods

__init__(*, seeds)

Initialize a SeedAttackTechniqueGroup.

from_yaml_file(file)

Create a new object from a YAML file.

is_single_part_single_text_request()

Check if this is a single text prompt.

is_single_request()

Check if all prompts are in a single sequence.

is_single_turn()

Check if this is a single-turn group (single request without objective).

render_template_value(**kwargs)

Render seed values as templates with provided parameters.

validate()

Validate the seed attack technique group state.

Attributes

harm_categories

Returns a deduplicated list of all harm categories from all seeds.

has_simulated_conversation

Check if this group uses simulated conversation generation.

next_message

Returns a Message containing only the last turn's prompts if it's a user message.

objective

Get the objective for this group.

prepended_conversation

Returns Messages that should be prepended as conversation history.

prompts

Get all SeedPrompt instances from this group.

simulated_conversation_config

Get the simulated conversation configuration if set.

user_messages

Returns all prompts as user Messages, one per sequence.

seeds

seeds: list[Seed]#
validate() None[source]#

Validate the seed attack technique group state.

Extends SeedGroup validation to require all seeds to be general strategies.

Raises:

ValueError – If validation fails.