pyrit.score.ConsoleScorerPrinter#
- class ConsoleScorerPrinter(*, indent_size: int = 2, enable_colors: bool = True)[source]#
Bases:
ScorerPrinterConsole printer for scorer information with enhanced formatting.
This printer formats scorer details for console display with optional color coding, proper indentation, and visual hierarchy. Colors can be disabled for consoles that don’t support ANSI characters.
- __init__(*, indent_size: int = 2, enable_colors: bool = True)[source]#
Initialize the console scorer printer.
- Parameters:
- Raises:
ValueError – If indent_size < 0.
Methods
__init__(*[, indent_size, enable_colors])Initialize the console scorer printer.
print_harm_scorer(scorer_identifier, *, ...)Print harm scorer information including type, nested scorers, and evaluation metrics.
print_objective_scorer(*, scorer_identifier)Print objective scorer information including type, nested scorers, and evaluation metrics.
- print_harm_scorer(scorer_identifier: ScorerIdentifier, *, harm_category: str) None[source]#
Print harm scorer information including type, nested scorers, and evaluation metrics.
This method displays: - Scorer type and identity information - Nested sub-scorers (for composite scorers) - Harm evaluation metrics (MAE, Krippendorff alpha) from the registry
- Parameters:
scorer_identifier (ScorerIdentifier) – The scorer identifier to print information for.
harm_category (str) – The harm category for looking up metrics (e.g., “hate_speech”, “violence”).
- print_objective_scorer(*, scorer_identifier: ScorerIdentifier) None[source]#
Print objective scorer information including type, nested scorers, and evaluation metrics.
This method displays: - Scorer type and identity information - Nested sub-scorers (for composite scorers) - Objective evaluation metrics (accuracy, precision, recall, F1) from the registry
- Parameters:
scorer_identifier (ScorerIdentifier) – The scorer identifier to print information for.