pyrit.executor.promptgen.FuzzerContext#

class FuzzerContext(prompts: ~typing.List[str], prompt_templates: ~typing.List[str], max_query_limit: int | None = None, total_target_query_count: int = 0, total_jailbreak_count: int = 0, jailbreak_conversation_ids: ~typing.List[str | ~uuid.UUID] = <factory>, executed_turns: int = 0, initial_prompt_nodes: ~typing.List[~pyrit.executor.promptgen.fuzzer._PromptNode] = <factory>, new_prompt_nodes: ~typing.List[~pyrit.executor.promptgen.fuzzer._PromptNode] = <factory>, mcts_selected_path: ~typing.List[~pyrit.executor.promptgen.fuzzer._PromptNode] = <factory>, last_choice_node: ~pyrit.executor.promptgen.fuzzer._PromptNode | None = None, memory_labels: ~typing.Dict[str, str] = <factory>)[source]#

Bases: PromptGeneratorStrategyContext

Context for the Fuzzer prompt generation strategy.

This context contains all execution-specific state for a Fuzzer prompt generation instance, ensuring thread safety by isolating state per execution.

__init__(prompts: ~typing.List[str], prompt_templates: ~typing.List[str], max_query_limit: int | None = None, total_target_query_count: int = 0, total_jailbreak_count: int = 0, jailbreak_conversation_ids: ~typing.List[str | ~uuid.UUID] = <factory>, executed_turns: int = 0, initial_prompt_nodes: ~typing.List[~pyrit.executor.promptgen.fuzzer._PromptNode] = <factory>, new_prompt_nodes: ~typing.List[~pyrit.executor.promptgen.fuzzer._PromptNode] = <factory>, mcts_selected_path: ~typing.List[~pyrit.executor.promptgen.fuzzer._PromptNode] = <factory>, last_choice_node: ~pyrit.executor.promptgen.fuzzer._PromptNode | None = None, memory_labels: ~typing.Dict[str, str] = <factory>) None#

Methods

__init__(prompts, prompt_templates[, ...])

duplicate()

Create a deep copy of the context.

Attributes

executed_turns: int = 0#
initial_prompt_nodes: List[_PromptNode]#
jailbreak_conversation_ids: List[str | UUID]#
last_choice_node: _PromptNode | None = None#
max_query_limit: int | None = None#
mcts_selected_path: List[_PromptNode]#
memory_labels: Dict[str, str]#
new_prompt_nodes: List[_PromptNode]#
prompt_templates: List[str]#
prompts: List[str]#
total_jailbreak_count: int = 0#
total_target_query_count: int = 0#