Class: Legion::Extensions::Agentic::Attention::Synesthesia::Helpers::SynestheticEvent

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/legion/extensions/agentic/attention/synesthesia/helpers/synesthetic_event.rb

Constant Summary

Constants included from Constants

Constants::DEFAULT_STRENGTH, Constants::INTENSITY_LABELS, Constants::MAX_EVENTS, Constants::MAX_MAPPINGS, Constants::MODALITIES, Constants::RICHNESS_LABELS, Constants::STRENGTH_BOOST, Constants::STRENGTH_DECAY, Constants::STRENGTH_LABELS, Constants::TRIGGER_THRESHOLD

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Constants

label_for

Constructor Details

#initialize(mapping_id:, source_input:, target_output:, intensity:, involuntary: true) ⇒ SynestheticEvent

Returns a new instance of SynestheticEvent.



17
18
19
20
21
22
23
24
25
# File 'lib/legion/extensions/agentic/attention/synesthesia/helpers/synesthetic_event.rb', line 17

def initialize(mapping_id:, source_input:, target_output:, intensity:, involuntary: true)
  @id            = SecureRandom.uuid
  @mapping_id    = mapping_id
  @source_input  = source_input
  @target_output = target_output
  @intensity     = intensity.clamp(0.0, 1.0)
  @involuntary   = involuntary
  @triggered_at  = Time.now.utc
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



14
15
16
# File 'lib/legion/extensions/agentic/attention/synesthesia/helpers/synesthetic_event.rb', line 14

def id
  @id
end

#intensityObject (readonly)

Returns the value of attribute intensity.



14
15
16
# File 'lib/legion/extensions/agentic/attention/synesthesia/helpers/synesthetic_event.rb', line 14

def intensity
  @intensity
end

#involuntaryObject (readonly)

Returns the value of attribute involuntary.



14
15
16
# File 'lib/legion/extensions/agentic/attention/synesthesia/helpers/synesthetic_event.rb', line 14

def involuntary
  @involuntary
end

#mapping_idObject (readonly)

Returns the value of attribute mapping_id.



14
15
16
# File 'lib/legion/extensions/agentic/attention/synesthesia/helpers/synesthetic_event.rb', line 14

def mapping_id
  @mapping_id
end

#source_inputObject (readonly)

Returns the value of attribute source_input.



14
15
16
# File 'lib/legion/extensions/agentic/attention/synesthesia/helpers/synesthetic_event.rb', line 14

def source_input
  @source_input
end

#target_outputObject (readonly)

Returns the value of attribute target_output.



14
15
16
# File 'lib/legion/extensions/agentic/attention/synesthesia/helpers/synesthetic_event.rb', line 14

def target_output
  @target_output
end

#triggered_atObject (readonly)

Returns the value of attribute triggered_at.



14
15
16
# File 'lib/legion/extensions/agentic/attention/synesthesia/helpers/synesthetic_event.rb', line 14

def triggered_at
  @triggered_at
end

Instance Method Details

#intensity_labelObject



27
28
29
# File 'lib/legion/extensions/agentic/attention/synesthesia/helpers/synesthetic_event.rb', line 27

def intensity_label
  Constants.label_for(INTENSITY_LABELS, @intensity)
end

#to_hObject



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/legion/extensions/agentic/attention/synesthesia/helpers/synesthetic_event.rb', line 31

def to_h
  {
    id:              @id,
    mapping_id:      @mapping_id,
    source_input:    @source_input,
    target_output:   @target_output,
    intensity:       @intensity,
    intensity_label: intensity_label,
    involuntary:     @involuntary,
    triggered_at:    @triggered_at
  }
end