class Riffer::Evals::ScenarioResult
Represents the result of evaluating a single scenario.
Contains the input, output, ground truth, and individual evaluator results.
scenario_result = Riffer::Evals::ScenarioResult.new( input: โWhat is Ruby?โ, output: โA programming language.โ, ground_truth: โA programming languageโ, results: [result1, result2] )
scenario_result.scores # => { MyEvaluator => 0.85 }
Attributes
The ground truth used during evaluation.
The input that was evaluated.
The agent output for this scenario.
Individual evaluation results.
Public Class Methods
Source
# File lib/riffer/evals/scenario_result.rb, line 33 def initialize(input:, output:, ground_truth:, results:) @input = input @output = output @ground_truth = ground_truth @results = results end
Initializes a new scenario result.
: (input: String, output: String, ground_truth: String?, results: Array) -> void
Public Instance Methods
Source
# File lib/riffer/evals/scenario_result.rb, line 43 def scores results.each_with_object({}) do |result, hash| hash[result.evaluator] = result.score end end
Returns scores keyed by evaluator class.
: () -> Hash[singleton(Riffer::Evals::Evaluator), Float]
Source
# File lib/riffer/evals/scenario_result.rb, line 52 def to_h { input: input, output: output, ground_truth: ground_truth, scores: scores.transform_keys(&:name), results: results.map(&:to_h) } end
Returns a hash representation of the scenario result.
: () -> Hash[Symbol, untyped]