Class: DecisionAgent::Evaluators::StaticEvaluator
- Defined in:
- lib/decision_agent/evaluators/static_evaluator.rb
Instance Attribute Summary collapse
-
#custom_metadata ⇒ Object
readonly
Returns the value of attribute custom_metadata.
-
#decision ⇒ Object
readonly
Returns the value of attribute decision.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
- #evaluate(_context, feedback: {}) ⇒ Object
-
#initialize(decision:, weight: 1.0, reason: "Static decision", name: nil, metadata: nil) ⇒ StaticEvaluator
constructor
A new instance of StaticEvaluator.
Constructor Details
#initialize(decision:, weight: 1.0, reason: "Static decision", name: nil, metadata: nil) ⇒ StaticEvaluator
Returns a new instance of StaticEvaluator.
8 9 10 11 12 13 14 |
# File 'lib/decision_agent/evaluators/static_evaluator.rb', line 8 def initialize(decision:, weight: 1.0, reason: "Static decision", name: nil, metadata: nil) @decision = decision @weight = weight.to_f @reason = reason @name = name || evaluator_name @custom_metadata = end |
Instance Attribute Details
#custom_metadata ⇒ Object (readonly)
Returns the value of attribute custom_metadata.
6 7 8 |
# File 'lib/decision_agent/evaluators/static_evaluator.rb', line 6 def @custom_metadata end |
#decision ⇒ Object (readonly)
Returns the value of attribute decision.
6 7 8 |
# File 'lib/decision_agent/evaluators/static_evaluator.rb', line 6 def decision @decision end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/decision_agent/evaluators/static_evaluator.rb', line 6 def name @name end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
6 7 8 |
# File 'lib/decision_agent/evaluators/static_evaluator.rb', line 6 def reason @reason end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
6 7 8 |
# File 'lib/decision_agent/evaluators/static_evaluator.rb', line 6 def weight @weight end |
Instance Method Details
#evaluate(_context, feedback: {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/decision_agent/evaluators/static_evaluator.rb', line 16 def evaluate(_context, feedback: {}) = @custom_metadata || { type: "static" } Evaluation.new( decision: @decision, weight: @weight, reason: @reason, evaluator_name: @name, metadata: ) end |