pyrit.models.Score#
- class Score(*, id: UUID | str | None = None, score_value: str, score_value_description: str, score_type: Literal['true_false', 'float_scale'], score_category: str, score_rationale: str, score_metadata: str, scorer_class_identifier: Dict[str, str] = None, prompt_request_response_id: str | UUID, timestamp: datetime | None = None, task: str | None = None)[source]#
Bases:
object
- __init__(*, id: UUID | str | None = None, score_value: str, score_value_description: str, score_type: Literal['true_false', 'float_scale'], score_category: str, score_rationale: str, score_metadata: str, scorer_class_identifier: Dict[str, str] = None, prompt_request_response_id: str | UUID, timestamp: datetime | None = None, task: str | None = None)[source]#
Methods
__init__
(*[, id, scorer_class_identifier, ...])Returns the value of the score based on its type.
validate
(scorer_type, score_value)Attributes
- get_value()[source]#
Returns the value of the score based on its type.
If the score type is “true_false”, it returns True if the score value is “true” (case-insensitive), otherwise it returns False.
If the score type is “float_scale”, it returns the score value as a float.
- Raises:
ValueError – If the score type is unknown.
- Returns:
The value of the score based on its type.