Class: RubyLLM::Modes::Decision
- Inherits:
-
Data
- Object
- Data
- RubyLLM::Modes::Decision
- Defined in:
- lib/ruby_llm/modes/decision.rb
Overview
What the classifier said, untouched.
mode_name: String or nil confidence: Float 0..1, or nil for "not scored" reason: String or nil probabilities: { name => Float } or nil
Instance Attribute Summary collapse
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#mode_name ⇒ Object
readonly
Returns the value of attribute mode_name.
-
#probabilities ⇒ Object
readonly
Returns the value of attribute probabilities.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Instance Method Summary collapse
-
#initialize(mode_name: nil, confidence: nil, reason: nil, probabilities: nil) ⇒ Decision
constructor
A new instance of Decision.
-
#to_h ⇒ Object
The fields with string keys, for logs and serialisation.
Constructor Details
#initialize(mode_name: nil, confidence: nil, reason: nil, probabilities: nil) ⇒ Decision
Returns a new instance of Decision.
12 13 14 |
# File 'lib/ruby_llm/modes/decision.rb', line 12 def initialize(mode_name: nil, confidence: nil, reason: nil, probabilities: nil) super end |
Instance Attribute Details
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence
11 12 13 |
# File 'lib/ruby_llm/modes/decision.rb', line 11 def confidence @confidence end |
#mode_name ⇒ Object (readonly)
Returns the value of attribute mode_name
11 12 13 |
# File 'lib/ruby_llm/modes/decision.rb', line 11 def mode_name @mode_name end |
#probabilities ⇒ Object (readonly)
Returns the value of attribute probabilities
11 12 13 |
# File 'lib/ruby_llm/modes/decision.rb', line 11 def probabilities @probabilities end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason
11 12 13 |
# File 'lib/ruby_llm/modes/decision.rb', line 11 def reason @reason end |
Instance Method Details
#to_h ⇒ Object
The fields with string keys, for logs and serialisation. "probabilities" is present only when the classifier set them.
18 19 20 21 |
# File 'lib/ruby_llm/modes/decision.rb', line 18 def to_h hash = super.transform_keys(&:to_s) probabilities ? hash.merge("probabilities" => probabilities.transform_keys(&:to_s)) : hash.except("probabilities") end |