pyrit.executor.workflow.XPIATestWorkflow

pyrit.executor.workflow.XPIATestWorkflow#

class XPIATestWorkflow(*, attack_setup_target: ~pyrit.prompt_target.common.prompt_target.PromptTarget, processing_target: ~pyrit.prompt_target.common.prompt_target.PromptTarget, scorer: ~pyrit.score.scorer.Scorer, converter_config: ~pyrit.executor.core.config.StrategyConverterConfig | None = None, prompt_normalizer: ~pyrit.prompt_normalizer.prompt_normalizer.PromptNormalizer | None = None, logger: ~logging.Logger = <Logger pyrit.executor.workflow.xpia (WARNING)>)[source]#

Bases: XPIAWorkflow

XPIA workflow with automated test processing.

This variant automatically handles the processing phase by sending a predefined prompt to a processing target. It is designed for automated testing scenarios where the processing can be scripted rather than manual.

The workflow creates an automated processing callback that sends the processing prompt to the configured processing target and returns the response.

__init__(*, attack_setup_target: ~pyrit.prompt_target.common.prompt_target.PromptTarget, processing_target: ~pyrit.prompt_target.common.prompt_target.PromptTarget, scorer: ~pyrit.score.scorer.Scorer, converter_config: ~pyrit.executor.core.config.StrategyConverterConfig | None = None, prompt_normalizer: ~pyrit.prompt_normalizer.prompt_normalizer.PromptNormalizer | None = None, logger: ~logging.Logger = <Logger pyrit.executor.workflow.xpia (WARNING)>) None[source]#

Initialize the XPIA test workflow.

Parameters:
  • attack_setup_target (PromptTarget) – The target that generates the attack prompt and gets it into the attack location.

  • processing_target (PromptTarget) – The target of the attack which processes the processing prompt. This should include references to invoke plugins (if any).

  • scorer (Scorer) – The scorer to use to score the processing response. This is required for test workflows to evaluate attack success.

  • converter_config (Optional[StrategyConverterConfig]) – Optional converter configuration for request and response converters.

  • prompt_normalizer (Optional[PromptNormalizer]) – Optional PromptNormalizer instance. If not provided, a new one will be created.

  • logger (logging.Logger) – Logger instance for logging events.

Methods

__init__(*, attack_setup_target, ...[, ...])

Initialize the XPIA test workflow.

execute_async(**kwargs)

Execute the XPIA workflow strategy asynchronously with the provided parameters.

execute_with_context_async(*, context)

Execute strategy with complete lifecycle management.

get_identifier()