Class: Legion::Extensions::Agentic::Integration::PhenomenalBinding::Helpers::Stream
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Integration::PhenomenalBinding::Helpers::Stream
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb
Constant Summary
Constants included from Constants
Constants::BINDING_BOOST, Constants::BINDING_DECAY, Constants::BINDING_TYPES, Constants::COHERENCE_LABELS, Constants::COHERENCE_THRESHOLD, Constants::DEFAULT_SALIENCE, Constants::MAX_BINDINGS, Constants::MAX_STREAMS, Constants::STREAM_TYPES
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#salience ⇒ Object
readonly
Returns the value of attribute salience.
-
#stream_type ⇒ Object
readonly
Returns the value of attribute stream_type.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
- #fresh?(window: 30) ⇒ Boolean
-
#initialize(stream_type:, content:, salience: DEFAULT_SALIENCE, domain: nil, timestamp: nil) ⇒ Stream
constructor
A new instance of Stream.
- #salient? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(stream_type:, content:, salience: DEFAULT_SALIENCE, domain: nil, timestamp: nil) ⇒ Stream
Returns a new instance of Stream.
16 17 18 19 20 21 22 23 24 |
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb', line 16 def initialize(stream_type:, content:, salience: DEFAULT_SALIENCE, domain: nil, timestamp: nil) @id = ::SecureRandom.uuid @stream_type = stream_type @content = content @salience = salience.clamp(0.0, 1.0) @domain = domain @timestamp = || Time.now.utc @created_at = Time.now.utc end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb', line 14 def content @content end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb', line 14 def created_at @created_at end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb', line 14 def domain @domain end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb', line 14 def id @id end |
#salience ⇒ Object (readonly)
Returns the value of attribute salience.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb', line 14 def salience @salience end |
#stream_type ⇒ Object (readonly)
Returns the value of attribute stream_type.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb', line 14 def stream_type @stream_type end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb', line 14 def @timestamp end |
Instance Method Details
#fresh?(window: 30) ⇒ Boolean
30 31 32 |
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb', line 30 def fresh?(window: 30) (Time.now.utc - created_at) <= window end |
#salient? ⇒ Boolean
26 27 28 |
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb', line 26 def salient? @salience >= DEFAULT_SALIENCE end |
#to_h ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/legion/extensions/agentic/integration/phenomenal_binding/helpers/stream.rb', line 34 def to_h { id: @id, stream_type: @stream_type, content: @content, salience: @salience.round(10), domain: @domain, timestamp: @timestamp, created_at: @created_at } end |