Class: RubyLLM::Contract::Eval::PromptDiff

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/ruby_llm/contract/eval/prompt_diff.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(candidate:, baseline:) ⇒ PromptDiff

Returns a new instance of PromptDiff.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ruby_llm/contract/eval/prompt_diff.rb', line 18

def initialize(candidate:, baseline:)
  @candidate_report = candidate
  @baseline_report = baseline
  serializer = PromptDiffSerializer.new
  candidate_cases = serializer.call(candidate)
  baseline_cases = serializer.call(baseline)
  @diff = BaselineDiff.new(
    baseline_cases: baseline_cases,
    current_cases: candidate_cases
  )
  @comparator = PromptDiffComparator.new(
    candidate_cases: candidate_cases,
    baseline_cases: baseline_cases,
    diff: @diff
  )
  @presenter = PromptDiffPresenter.new(prompt_diff: self, comparator: @comparator)
  freeze
end

Instance Attribute Details

#baseline_reportObject (readonly)

Returns the value of attribute baseline_report.



11
12
13
# File 'lib/ruby_llm/contract/eval/prompt_diff.rb', line 11

def baseline_report
  @baseline_report
end

#candidate_reportObject (readonly)

Returns the value of attribute candidate_report.



11
12
13
# File 'lib/ruby_llm/contract/eval/prompt_diff.rb', line 11

def candidate_report
  @candidate_report
end