Class: RubyLLM::Evals::Run

Inherits:
ApplicationRecord show all
Includes:
JobTrackable
Defined in:
app/models/ruby_llm/evals/run.rb

Instance Method Summary collapse

Methods included from JobTrackable

#finished?

Instance Method Details

#accuracy ⇒ Object



20
21
22
23
24
# File 'app/models/ruby_llm/evals/run.rb', line 20

def accuracy
  return 0.0 if prompt_executions.none?

  (prompt_executions.where(passed: true).count * 100.0 / prompt_executions.count).round 2
end

#cost ⇒ Object



26
27
28
# File 'app/models/ruby_llm/evals/run.rb', line 26

def cost
  prompt_executions.sum(&:cost).round(4)
end

#judge_cost ⇒ Object



30
31
32
# File 'app/models/ruby_llm/evals/run.rb', line 30

def judge_cost
  prompt_executions.sum(&:judge_cost).round(4)
end

#total_cost ⇒ Object



34
35
36
# File 'app/models/ruby_llm/evals/run.rb', line 34

def total_cost
  (cost + judge_cost).round(4)
end