Class: Legion::Extensions::Agentic::Attention::Surprise::Helpers::SurpriseEvent
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Attention::Surprise::Helpers::SurpriseEvent
- Defined in:
- lib/legion/extensions/agentic/attention/surprise/helpers/surprise_event.rb
Instance Attribute Summary collapse
-
#actual ⇒ Object
readonly
Returns the value of attribute actual.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#magnitude ⇒ Object
readonly
Returns the value of attribute magnitude.
-
#orienting ⇒ Object
readonly
Returns the value of attribute orienting.
-
#predicted ⇒ Object
readonly
Returns the value of attribute predicted.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#valence ⇒ Object
readonly
Returns the value of attribute valence.
Instance Method Summary collapse
-
#initialize(domain:, predicted:, actual:, magnitude:, valence:, orienting: false) ⇒ SurpriseEvent
constructor
A new instance of SurpriseEvent.
- #to_h ⇒ Object
Constructor Details
#initialize(domain:, predicted:, actual:, magnitude:, valence:, orienting: false) ⇒ SurpriseEvent
Returns a new instance of SurpriseEvent.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/legion/extensions/agentic/attention/surprise/helpers/surprise_event.rb', line 14 def initialize(domain:, predicted:, actual:, magnitude:, valence:, orienting: false) @id = SecureRandom.uuid @domain = domain @predicted = predicted @actual = actual @magnitude = magnitude.clamp(0.0, 1.0) @valence = valence @orienting = orienting @timestamp = Time.now.utc end |
Instance Attribute Details
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/surprise/helpers/surprise_event.rb', line 12 def actual @actual end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/surprise/helpers/surprise_event.rb', line 12 def domain @domain end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/surprise/helpers/surprise_event.rb', line 12 def id @id end |
#magnitude ⇒ Object (readonly)
Returns the value of attribute magnitude.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/surprise/helpers/surprise_event.rb', line 12 def magnitude @magnitude end |
#orienting ⇒ Object (readonly)
Returns the value of attribute orienting.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/surprise/helpers/surprise_event.rb', line 12 def orienting @orienting end |
#predicted ⇒ Object (readonly)
Returns the value of attribute predicted.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/surprise/helpers/surprise_event.rb', line 12 def predicted @predicted end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/surprise/helpers/surprise_event.rb', line 12 def @timestamp end |
#valence ⇒ Object (readonly)
Returns the value of attribute valence.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/surprise/helpers/surprise_event.rb', line 12 def valence @valence end |
Instance Method Details
#to_h ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/legion/extensions/agentic/attention/surprise/helpers/surprise_event.rb', line 25 def to_h { id: @id, domain: @domain, predicted: @predicted, actual: @actual, magnitude: @magnitude.round(4), valence: @valence, orienting: @orienting, timestamp: @timestamp } end |