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
-
#classifications ⇒ Object
readonly
Returns the value of attribute classifications.
-
#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, classifications: 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, classifications: nil) ⇒ Result
Create a new result
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/braintrust/eval/result.rb', line 24 def initialize(experiment_id:, experiment_name:, project_id:, project_name:, permalink:, errors:, duration:, scores: nil, classifications: 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 @classifications = classifications end |
Instance Attribute Details
#classifications ⇒ Object (readonly)
Returns the value of attribute classifications.
11 12 13 |
# File 'lib/braintrust/eval/result.rb', line 11 def classifications @classifications end |
#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)
45 46 47 |
# File 'lib/braintrust/eval/result.rb', line 45 def failed? !success? end |
#scorer_stats ⇒ Hash<String, ScorerStats>
Get statistics for all scorers (lazily computed from scores)
76 77 78 |
# File 'lib/braintrust/eval/result.rb', line 76 def scorer_stats @scorer_stats ||= build_scorer_stats end |
#success? ⇒ Boolean
Check if the evaluation was successful (no errors)
39 40 41 |
# File 'lib/braintrust/eval/result.rb', line 39 def success? errors.empty? end |
#summary ⇒ ExperimentSummary
Get the experiment summary (lazily computed)
51 52 53 |
# File 'lib/braintrust/eval/result.rb', line 51 def summary @summary ||= build_summary end |
#to_pretty ⇒ String
Format the result as a pretty CLI output with box drawing and colors
70 71 72 |
# File 'lib/braintrust/eval/result.rb', line 70 def to_pretty Formatter.format_experiment_summary(summary) end |
#to_s ⇒ String
Format the result as a human-readable string (Go SDK format)
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/braintrust/eval/result.rb', line 57 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 |