pyrit.models.SeedAttackTechniqueGroup#
- class SeedAttackTechniqueGroup(*, seeds: Sequence[Seed | dict[str, Any]])[source]#
Bases:
SeedGroupA 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_categoriesReturns a deduplicated list of all harm categories from all seeds.
has_simulated_conversationCheck if this group uses simulated conversation generation.
next_messageReturns a Message containing only the last turn's prompts if it's a user message.
objectiveGet the objective for this group.
prepended_conversationReturns Messages that should be prepended as conversation history.
promptsGet all SeedPrompt instances from this group.
simulated_conversation_configGet the simulated conversation configuration if set.
user_messagesReturns all prompts as user Messages, one per sequence.
- 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.