Class: RubyLLM::Agents::Eval::Score
- Inherits:
-
Struct
- Object
- Struct
- RubyLLM::Agents::Eval::Score
- Defined in:
- lib/ruby_llm/agents/eval/eval_suite.rb
Overview
Score value object — returned by every scorer
Instance Attribute Summary collapse
-
#reason ⇒ Object
Returns the value of attribute reason.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #failed?(threshold = 0.5) ⇒ Boolean
-
#initialize(value:, reason: nil) ⇒ Score
constructor
A new instance of Score.
- #passed?(threshold = 0.5) ⇒ Boolean
Constructor Details
#initialize(value:, reason: nil) ⇒ Score
Returns a new instance of Score.
8 9 10 |
# File 'lib/ruby_llm/agents/eval/eval_suite.rb', line 8 def initialize(value:, reason: nil) super(value: value.to_f.clamp(0.0, 1.0), reason: reason) end |
Instance Attribute Details
#reason ⇒ Object
Returns the value of attribute reason
7 8 9 |
# File 'lib/ruby_llm/agents/eval/eval_suite.rb', line 7 def reason @reason end |
#value ⇒ Object
Returns the value of attribute value
7 8 9 |
# File 'lib/ruby_llm/agents/eval/eval_suite.rb', line 7 def value @value end |
Instance Method Details
#failed?(threshold = 0.5) ⇒ Boolean
16 17 18 |
# File 'lib/ruby_llm/agents/eval/eval_suite.rb', line 16 def failed?(threshold = 0.5) !passed?(threshold) end |
#passed?(threshold = 0.5) ⇒ Boolean
12 13 14 |
# File 'lib/ruby_llm/agents/eval/eval_suite.rb', line 12 def passed?(threshold = 0.5) value >= threshold end |