class Riffer::Evals::Result
Represents the result of a single evaluation.
Attributes
The evaluator class that produced this result.
Whether higher scores are better for this evaluator.
Additional metadata from the evaluation.
Human-readable explanation of the score.
The evaluation score (0.0 to 1.0).
Token usage for the judge call that produced this result, when the evaluator used an LLM. Nil for rule-based evaluators.
Public Class Methods
Source
# File lib/riffer/evals/result.rb, line 28 def initialize(evaluator:, score:, reason: nil, metadata: {}, higher_is_better: true, token_usage: nil) @evaluator = evaluator @score = score.to_f validate_score! @reason = reason @metadata = metadata @higher_is_better = higher_is_better @token_usage = token_usage end
Raises Riffer::ArgumentError if score is not between 0.0 and 1.0.
Public Instance Methods
Source
# File lib/riffer/evals/result.rb, line 42 def to_h { evaluator: evaluator.name, score: score, reason: reason, metadata: metadata, higher_is_better: higher_is_better, token_usage: token_usage&.to_h, } end
Returns a hash representation of the result.