Class: ActionAgent::EvaluationRun

Inherits:
ApplicationRecord show all
Defined in:
app/models/action_agent/evaluation_run.rb

Overview

One execution of an Evaluation over a sample of the agent's generations. scores: { criterion_key => { "score", "min", "max", "passed", "total" } }

Instance Method Summary collapse

Methods inherited from ApplicationRecord

for_owner, owner_association

Instance Method Details

#average_scoreObject



13
14
15
16
17
18
# File 'app/models/action_agent/evaluation_run.rb', line 13

def average_score
  values = scores.values.map { |s| s["score"] }.compact
  return nil if values.empty?

  (values.sum.to_f / values.size).round(3)
end