pyrit.executor.promptgen.PromptGeneratorStrategy#
- class PromptGeneratorStrategy(context_type: type[~pyrit.executor.promptgen.core.prompt_generator_strategy.PromptGeneratorStrategyContextT], logger: ~logging.Logger = <Logger ai-red-team (INFO)>, event_handler: ~pyrit.executor.core.strategy.StrategyEventHandler[~pyrit.executor.promptgen.core.prompt_generator_strategy.PromptGeneratorStrategyContextT, ~pyrit.executor.promptgen.core.prompt_generator_strategy.PromptGeneratorStrategyResultT] | None = None)[source]#
Bases:
Strategy
[PromptGeneratorStrategyContextT
,PromptGeneratorStrategyResultT
],ABC
Base class for all prompt generator strategies. Provides a structure for implementing specific prompt generation strategies.
- __init__(context_type: type[~pyrit.executor.promptgen.core.prompt_generator_strategy.PromptGeneratorStrategyContextT], logger: ~logging.Logger = <Logger ai-red-team (INFO)>, event_handler: ~pyrit.executor.core.strategy.StrategyEventHandler[~pyrit.executor.promptgen.core.prompt_generator_strategy.PromptGeneratorStrategyContextT, ~pyrit.executor.promptgen.core.prompt_generator_strategy.PromptGeneratorStrategyResultT] | None = None)[source]#
Initialize the prompt generator strategy.
- Parameters:
context_type (type) – Type of the context used by the strategy.
logger (logging.Logger) – Logger instance for logging events.
event_handler (StrategyEventHandler) – Event handler for handling strategy events.
Methods
__init__
(context_type[, logger, event_handler])Initialize the prompt generator strategy.
execute_async
(**kwargs)Execute the strategy asynchronously with the given keyword arguments.
execute_with_context_async
(*, context)Execute strategy with complete lifecycle management.
get_identifier
()