pyrit.executor.promptgen.fuzzer.FuzzerContext#

class FuzzerContext(prompts: list[str], prompt_templates: list[str], max_query_limit: int | None = None, total_target_query_count: int = 0, total_jailbreak_count: int = 0, jailbreak_conversation_ids: list[str | ~uuid.UUID] = <factory>, executed_turns: int = 0, initial_prompt_nodes: list[~pyrit.executor.promptgen.fuzzer.fuzzer._PromptNode] = <factory>, new_prompt_nodes: list[~pyrit.executor.promptgen.fuzzer.fuzzer._PromptNode] = <factory>, mcts_selected_path: list[~pyrit.executor.promptgen.fuzzer.fuzzer._PromptNode] = <factory>, last_choice_node: ~pyrit.executor.promptgen.fuzzer.fuzzer._PromptNode | None = None, memory_labels: 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: list[str], prompt_templates: list[str], max_query_limit: int | None = None, total_target_query_count: int = 0, total_jailbreak_count: int = 0, jailbreak_conversation_ids: list[str | ~uuid.UUID] = <factory>, executed_turns: int = 0, initial_prompt_nodes: list[~pyrit.executor.promptgen.fuzzer.fuzzer._PromptNode] = <factory>, new_prompt_nodes: list[~pyrit.executor.promptgen.fuzzer.fuzzer._PromptNode] = <factory>, mcts_selected_path: list[~pyrit.executor.promptgen.fuzzer.fuzzer._PromptNode] = <factory>, last_choice_node: ~pyrit.executor.promptgen.fuzzer.fuzzer._PromptNode | None = None, memory_labels: 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#