pyrit.executor.attack.SingleTurnAttackContext#
- class SingleTurnAttackContext(params: AttackParamsT, start_time: float = 0.0, related_conversations: set[ConversationReference] = <factory>, _next_message_override: Optional[Message] = None, _prepended_conversation_override: Optional[List[Message]] = None, _memory_labels_override: Optional[Dict[str, str]] = None, conversation_id: str = <factory>, system_prompt: Optional[str] = None, metadata: Optional[dict[str, Union[str, int]]] = None)[source]#
Bases:
AttackContext[AttackParamsT]Context for single-turn attacks.
Holds execution state for single-turn attacks. The immutable attack parameters (objective, next_message, prepended_conversation, memory_labels) are stored in the params field inherited from AttackContext.
- __init__(params: AttackParamsT, start_time: float = 0.0, related_conversations: set[ConversationReference] = <factory>, _next_message_override: Optional[Message] = None, _prepended_conversation_override: Optional[List[Message]] = None, _memory_labels_override: Optional[Dict[str, str]] = None, conversation_id: str = <factory>, system_prompt: Optional[str] = None, metadata: Optional[dict[str, Union[str, int]]] = None) None#
Methods
__init__(params[, start_time, ...])duplicate()Create a deep copy of the context.
Attributes
memory_labelsAdditional labels that can be applied to the prompts throughout the attack.
next_messageOptional message to send to the objective target.
objectiveNatural-language description of what the attack tries to achieve.
prepended_conversationConversation that is automatically prepended to the target model.
start_timeparamsrelated_conversations