Class: SkillBench::Services::ComparisonReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/skill_bench/services/comparison_reporter.rb

Overview

Prints a formatted comparison report for two evaluation results.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result_a, result_b, label_a, label_b) ⇒ ComparisonReporter

Returns a new instance of ComparisonReporter.

Parameters:

  • result_a (Hash)

    First evaluation result

  • result_b (Hash)

    Second evaluation result

  • label_a (String)

    Label for first variant

  • label_b (String)

    Label for second variant



22
23
24
25
26
27
# File 'lib/skill_bench/services/comparison_reporter.rb', line 22

def initialize(result_a, result_b, label_a, label_b)
  @result_a = result_a
  @result_b = result_b
  @label_a = label_a
  @label_b = label_b
end

Class Method Details

.call(result_a, result_b, label_a, label_b) ⇒ nil

Prints the comparison report to stdout.

Parameters:

  • result_a (Hash)

    First evaluation result

  • result_b (Hash)

    Second evaluation result

  • label_a (String)

    Label for first variant

  • label_b (String)

    Label for second variant

Returns:

  • (nil)


14
15
16
# File 'lib/skill_bench/services/comparison_reporter.rb', line 14

def self.call(result_a, result_b, label_a, label_b)
  new(result_a, result_b, label_a, label_b).call
end

Instance Method Details

#callnil

Prints the comparison report to stdout.

Returns:

  • (nil)


32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/skill_bench/services/comparison_reporter.rb', line 32

def call
  puts "\n=== Comparison Report ==="
  puts "| Dimension | #{@label_a} | #{@label_b} | Delta |"
  puts '|-----------|----------|----------|-------|'

  report_a = @result_a.dig(:response, :report)
  report_b = @result_b.dig(:response, :report)
  return unless report_a && report_b

  print_dimension_scores(report_a, report_b)
  print_total_scores(report_a, report_b)
  print_verdicts(report_a, report_b)
end