pyrit.executor.attack.AttackResultPrinter#

class AttackResultPrinter[source]#

Bases: ABC

Abstract base class for printing attack results.

This interface defines the contract for printing attack results in various formats. Implementations can render results to console, logs, files, or other outputs.

__init__()#

Methods

__init__()

print_conversation_async(result, *[, ...])

Print only the conversation history.

print_result_async(result, *[, ...])

Print the complete attack result.

print_summary_async(result)

Print a summary of the attack result without the full conversation.

abstract async print_conversation_async(result: AttackResult, *, include_scores: bool = False) None[source]#

Print only the conversation history.

Parameters:
  • result (AttackResult) – The attack result containing the conversation to print

  • include_scores (bool) – Whether to include scores in the output. Defaults to False.

abstract async print_result_async(result: AttackResult, *, include_auxiliary_scores: bool = False, include_pruned_conversations: bool = False, include_adversarial_conversation: bool = False) None[source]#

Print the complete attack result.

Parameters:
  • result (AttackResult) – The attack result to print

  • include_auxiliary_scores (bool) – Whether to include auxiliary scores in the output. Defaults to False.

  • include_pruned_conversations (bool) – Whether to include pruned conversations. For each pruned conversation, only the last message and its score are shown. Defaults to False.

  • include_adversarial_conversation (bool) – Whether to include the adversarial conversation (the red teaming LLM’s reasoning). Only shown for successful attacks to avoid overwhelming output. Defaults to False.

abstract async print_summary_async(result: AttackResult) None[source]#

Print a summary of the attack result without the full conversation.

Parameters:

result (AttackResult) – The attack result to summarize