in pyrit/orchestrator/multi_turn/tree_of_attacks_node.py [0:0]
def duplicate(self) -> TreeOfAttacksNode:
"""
Creates a duplicate of the provided instance
with incremented iteration and new conversations ids (but duplicated conversations)
"""
duplicate_node = TreeOfAttacksNode(
objective_target=self._objective_target,
adversarial_chat=self._adversarial_chat,
adversarial_chat_seed_prompt=self._adversarial_chat_seed_prompt,
adversarial_chat_prompt_template=self._adversarial_chat_prompt_template,
adversarial_chat_system_seed_prompt=self._adversarial_chat_system_seed_prompt,
objective_scorer=self._objective_scorer,
on_topic_scorer=self._on_topic_scorer,
prompt_converters=self._prompt_converters,
orchestrator_id=self._orchestrator_id,
memory_labels=self._global_memory_labels,
desired_response_prefix=self._desired_response_prefix,
parent_id=self.node_id,
)
duplicate_node.objective_target_conversation_id = self._memory.duplicate_conversation(
conversation_id=self.objective_target_conversation_id
)
duplicate_node.adversarial_chat_conversation_id = self._memory.duplicate_conversation(
conversation_id=self.adversarial_chat_conversation_id,
)
return duplicate_node