Python

ScorerData

The result from a single scorer for one example.

The result from a single scorer for one example.

Each ScoringResult contains a list of ScorerData -- one per scorer that was run. Check success to see if the score met the threshold, and reason for the scorer's explanation.

Attributes

name

:

str

Scorer name (e.g. "faithfulness").

threshold

:

float

Minimum score required for success=True.

success

:

bool

Whether the score met or exceeded the threshold.

score

:

Optional[float]

The numeric score (0.0 to 1.0 by default).

Default:

None

minimum_score_range

:

float

Lower bound of the scoring scale.

Default:

0

maximum_score_range

:

float

Upper bound of the scoring scale.

Default:

1

reason

:

Optional[str]

The scorer's explanation for the score.

Default:

None

evaluation_model

:

Optional[str]

The LLM used to produce the score.

Default:

None

error

:

Optional[str]

Error message if scoring failed.

Default:

None

additional_metadata

:

Dict[str, Any]

Extra metadata from the scorer.

Default:

field(default_factory=dict)

id

:

Optional[str]

Unique identifier for this result.

Default:

None


to_dict()

Serialize to a dictionary, omitting None fields.

def to_dict() -> Dict[str, Any]:

Returns

Dict[str, Any]