pyrit.score.ScorerPrinter#
- class ScorerPrinter[source]#
Bases:
ABCAbstract base class for printing scorer information.
This interface defines the contract for printing scorer details including type information, nested sub-scorers, and evaluation metrics from the registry. Implementations can render output to console, logs, files, or other outputs.
- __init__()#
Methods
__init__()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.
- abstract 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”).
- abstract 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.