Class: Braintrust::Eval::Result
- Inherits:
-
Object
- Object
- Braintrust::Eval::Result
- Defined in:
- lib/braintrust/eval/result.rb
Overview
Result represents the outcome of an evaluation run Contains experiment metadata, errors, timing information, and raw score data
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#experiment_id ⇒ Object
readonly
Returns the value of attribute experiment_id.
-
#experiment_name ⇒ Object
readonly
Returns the value of attribute experiment_name.
-
#permalink ⇒ Object
readonly
Returns the value of attribute permalink.
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
-
#project_name ⇒ Object
readonly
Returns the value of attribute project_name.
-
#scores ⇒ Object
readonly
Returns the value of attribute scores.
Instance Method Summary collapse
-
#failed? ⇒ Boolean
Check if the evaluation failed (has errors).
-
#initialize(experiment_id:, experiment_name:, project_id:, project_name:, permalink:, errors:, duration:, scores: nil) ⇒ Result
constructor
Create a new result.
-
#scorer_stats ⇒ Hash<String, ScorerStats>
Get statistics for all scorers (lazily computed from scores).
-
#success? ⇒ Boolean
Check if the evaluation was successful (no errors).
-
#summary ⇒ ExperimentSummary
Get the experiment summary (lazily computed).
-
#to_pretty ⇒ String
Format the result as a pretty CLI output with box drawing and colors.
-
#to_s ⇒ String
Format the result as a human-readable string (Go SDK format).
Constructor Details
#initialize(experiment_id:, experiment_name:, project_id:, project_name:, permalink:, errors:, duration:, scores: nil) ⇒ Result
Create a new result
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/braintrust/eval/result.rb', line 23 def initialize(experiment_id:, experiment_name:, project_id:, project_name:, permalink:, errors:, duration:, scores: nil) @experiment_id = experiment_id @experiment_name = experiment_name @project_id = project_id @project_name = project_name @permalink = permalink @errors = errors @duration = duration @scores = scores end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
11 12 13 |
# File 'lib/braintrust/eval/result.rb', line 11 def duration @duration end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
11 12 13 |
# File 'lib/braintrust/eval/result.rb', line 11 def errors @errors end |
#experiment_id ⇒ Object (readonly)
Returns the value of attribute experiment_id.
11 12 13 |
# File 'lib/braintrust/eval/result.rb', line 11 def experiment_id @experiment_id end |
#experiment_name ⇒ Object (readonly)
Returns the value of attribute experiment_name.
11 12 13 |
# File 'lib/braintrust/eval/result.rb', line 11 def experiment_name @experiment_name end |
#permalink ⇒ Object (readonly)
Returns the value of attribute permalink.
11 12 13 |
# File 'lib/braintrust/eval/result.rb', line 11 def permalink @permalink end |
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id.
11 12 13 |
# File 'lib/braintrust/eval/result.rb', line 11 def project_id @project_id end |
#project_name ⇒ Object (readonly)
Returns the value of attribute project_name.
11 12 13 |
# File 'lib/braintrust/eval/result.rb', line 11 def project_name @project_name end |
#scores ⇒ Object (readonly)
Returns the value of attribute scores.
11 12 13 |
# File 'lib/braintrust/eval/result.rb', line 11 def scores @scores end |
Instance Method Details
#failed? ⇒ Boolean
Check if the evaluation failed (has errors)
43 44 45 |
# File 'lib/braintrust/eval/result.rb', line 43 def failed? !success? end |
#scorer_stats ⇒ Hash<String, ScorerStats>
Get statistics for all scorers (lazily computed from scores)
74 75 76 |
# File 'lib/braintrust/eval/result.rb', line 74 def scorer_stats @scorer_stats ||= build_scorer_stats end |
#success? ⇒ Boolean
Check if the evaluation was successful (no errors)
37 38 39 |
# File 'lib/braintrust/eval/result.rb', line 37 def success? errors.empty? end |
#summary ⇒ ExperimentSummary
Get the experiment summary (lazily computed)
49 50 51 |
# File 'lib/braintrust/eval/result.rb', line 49 def summary @summary ||= build_summary end |
#to_pretty ⇒ String
Format the result as a pretty CLI output with box drawing and colors
68 69 70 |
# File 'lib/braintrust/eval/result.rb', line 68 def to_pretty Formatter.format_experiment_summary(summary) end |
#to_s ⇒ String
Format the result as a human-readable string (Go SDK format)
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/braintrust/eval/result.rb', line 55 def to_s [ "Experiment: #{experiment_name}", "Project: #{project_name}", "ID: #{experiment_id}", "Link: #{permalink}", "Duration: #{duration.round(4)}s", "Errors: #{errors.length}" ].join("\n") end |