Class: Legion::Extensions::Agentic::Integration::SituationModel::Helpers::SituationEvent
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Integration::SituationModel::Helpers::SituationEvent
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/integration/situation_model/helpers/situation_event.rb
Constant Summary
Constants included from Constants
Constants::COHERENCE_CEILING, Constants::COHERENCE_FLOOR, Constants::CONTINUITY_LABELS, Constants::DECAY_RATE, Constants::DEFAULT_DIMENSION_VALUE, Constants::DIMENSIONS, Constants::MAX_EVENTS_PER_MODEL, Constants::MAX_HISTORY, Constants::MAX_MODELS, Constants::MODEL_HEALTH_LABELS
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#dimension_values ⇒ Object
readonly
Returns the value of attribute dimension_values.
Instance Method Summary collapse
- #continuity_with(other_event) ⇒ Object
- #discontinuous_dimensions(other_event, threshold: 0.3) ⇒ Object
-
#initialize(content:, dimension_values: {}) ⇒ SituationEvent
constructor
A new instance of SituationEvent.
- #to_h ⇒ Object
Constructor Details
#initialize(content:, dimension_values: {}) ⇒ SituationEvent
Returns a new instance of SituationEvent.
14 15 16 17 18 |
# File 'lib/legion/extensions/agentic/integration/situation_model/helpers/situation_event.rb', line 14 def initialize(content:, dimension_values: {}) @content = content @dimension_values = build_dimension_values(dimension_values) @created_at = Time.now.utc end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
12 13 14 |
# File 'lib/legion/extensions/agentic/integration/situation_model/helpers/situation_event.rb', line 12 def content @content end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/integration/situation_model/helpers/situation_event.rb', line 12 def created_at @created_at end |
#dimension_values ⇒ Object (readonly)
Returns the value of attribute dimension_values.
12 13 14 |
# File 'lib/legion/extensions/agentic/integration/situation_model/helpers/situation_event.rb', line 12 def dimension_values @dimension_values end |
Instance Method Details
#continuity_with(other_event) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/legion/extensions/agentic/integration/situation_model/helpers/situation_event.rb', line 20 def continuity_with(other_event) total_diff = DIMENSIONS.sum do |dim| (dimension_values[dim] - other_event.dimension_values[dim]).abs end avg_diff = total_diff / DIMENSIONS.size.to_f 1.0 - avg_diff end |
#discontinuous_dimensions(other_event, threshold: 0.3) ⇒ Object
28 29 30 31 32 |
# File 'lib/legion/extensions/agentic/integration/situation_model/helpers/situation_event.rb', line 28 def discontinuous_dimensions(other_event, threshold: 0.3) DIMENSIONS.select do |dim| (dimension_values[dim] - other_event.dimension_values[dim]).abs > threshold end end |
#to_h ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/legion/extensions/agentic/integration/situation_model/helpers/situation_event.rb', line 34 def to_h { content: content, dimension_values: dimension_values, created_at: created_at.iso8601 } end |