Class: Legion::Extensions::Agentic::Integration::Synthesis::Helpers::Synthesis
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Integration::Synthesis::Helpers::Synthesis
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb
Constant Summary
Constants included from Constants
Constants::COHERENCE_LABELS, Constants::COHERENCE_THRESHOLD, Constants::CONFIDENCE_LABELS, Constants::DEFAULT_WEIGHT, Constants::FRESHNESS_DECAY, Constants::MAX_STREAMS, Constants::MAX_SYNTHESES, Constants::MIN_STREAMS_FOR_SYNTHESIS, Constants::NOVELTY_THRESHOLD, Constants::STREAM_TYPES
Instance Attribute Summary collapse
-
#coherence ⇒ Object
readonly
Returns the value of attribute coherence.
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#novelty ⇒ Object
readonly
Returns the value of attribute novelty.
-
#streams ⇒ Object
readonly
Returns the value of attribute streams.
Instance Method Summary collapse
- #coherence_label ⇒ Object
- #confidence_label ⇒ Object
- #fragmented? ⇒ Boolean
-
#initialize(streams:, coherence:, novelty:, confidence:, content:) ⇒ Synthesis
constructor
A new instance of Synthesis.
- #novel? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(streams:, coherence:, novelty:, confidence:, content:) ⇒ Synthesis
Returns a new instance of Synthesis.
16 17 18 19 20 21 22 23 24 |
# File 'lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb', line 16 def initialize(streams:, coherence:, novelty:, confidence:, content:) @id = SecureRandom.uuid @streams = streams @coherence = coherence.clamp(0.0, 1.0) @novelty = novelty.clamp(0.0, 1.0) @confidence = confidence.clamp(0.0, 1.0) @content = content @created_at = Time.now.utc end |
Instance Attribute Details
#coherence ⇒ Object (readonly)
Returns the value of attribute coherence.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb', line 14 def coherence @coherence end |
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb', line 14 def confidence @confidence end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.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/synthesis/helpers/synthesis.rb', line 14 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb', line 14 def id @id end |
#novelty ⇒ Object (readonly)
Returns the value of attribute novelty.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb', line 14 def novelty @novelty end |
#streams ⇒ Object (readonly)
Returns the value of attribute streams.
14 15 16 |
# File 'lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb', line 14 def streams @streams end |
Instance Method Details
#coherence_label ⇒ Object
34 35 36 |
# File 'lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb', line 34 def coherence_label COHERENCE_LABELS.find { |range, _| range.cover?(@coherence) }&.last || :chaotic end |
#confidence_label ⇒ Object
38 39 40 |
# File 'lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb', line 38 def confidence_label CONFIDENCE_LABELS.find { |range, _| range.cover?(@confidence) }&.last || :guessing end |
#fragmented? ⇒ Boolean
26 27 28 |
# File 'lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb', line 26 def fragmented? @coherence < COHERENCE_THRESHOLD end |
#novel? ⇒ Boolean
30 31 32 |
# File 'lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb', line 30 def novel? @novelty > NOVELTY_THRESHOLD end |
#to_h ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/legion/extensions/agentic/integration/synthesis/helpers/synthesis.rb', line 42 def to_h { id: @id, streams: @streams, coherence: @coherence, novelty: @novelty, confidence: @confidence, content: @content, fragmented: fragmented?, novel: novel?, coherence_label: coherence_label, confidence_label: confidence_label, created_at: @created_at } end |