Class: Legion::Extensions::Agentic::Inference::Horizon::Helpers::Projection
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Inference::Horizon::Helpers::Projection
- Defined in:
- lib/legion/extensions/agentic/inference/horizon/helpers/projection.rb
Instance Attribute Summary collapse
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#construal_level ⇒ Object
readonly
Returns the value of attribute construal_level.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#horizon_distance ⇒ Object
readonly
Returns the value of attribute horizon_distance.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #abstract? ⇒ Boolean
- #concrete? ⇒ Boolean
-
#initialize(description:, domain: :general, horizon_distance: Constants::DEFAULT_HORIZON, confidence: 1.0, construal_level: nil) ⇒ Projection
constructor
A new instance of Projection.
- #to_h ⇒ Object
Constructor Details
#initialize(description:, domain: :general, horizon_distance: Constants::DEFAULT_HORIZON, confidence: 1.0, construal_level: nil) ⇒ Projection
Returns a new instance of Projection.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/legion/extensions/agentic/inference/horizon/helpers/projection.rb', line 14 def initialize(description:, domain: :general, horizon_distance: Constants::DEFAULT_HORIZON, confidence: 1.0, construal_level: nil) @id = SecureRandom.uuid @description = description @domain = domain @horizon_distance = horizon_distance.clamp(0.0, 1.0) @confidence = confidence.clamp(0.0, 1.0) @construal_level = construal_level || derive_construal_level(@horizon_distance) @created_at = Time.now.utc end |
Instance Attribute Details
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/horizon/helpers/projection.rb', line 12 def confidence @confidence end |
#construal_level ⇒ Object (readonly)
Returns the value of attribute construal_level.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/horizon/helpers/projection.rb', line 12 def construal_level @construal_level end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/horizon/helpers/projection.rb', line 12 def created_at @created_at end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/horizon/helpers/projection.rb', line 12 def description @description end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/horizon/helpers/projection.rb', line 12 def domain @domain end |
#horizon_distance ⇒ Object (readonly)
Returns the value of attribute horizon_distance.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/horizon/helpers/projection.rb', line 12 def horizon_distance @horizon_distance end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/horizon/helpers/projection.rb', line 12 def id @id end |
Instance Method Details
#abstract? ⇒ Boolean
29 30 31 |
# File 'lib/legion/extensions/agentic/inference/horizon/helpers/projection.rb', line 29 def abstract? @horizon_distance >= 0.7 end |
#concrete? ⇒ Boolean
25 26 27 |
# File 'lib/legion/extensions/agentic/inference/horizon/helpers/projection.rb', line 25 def concrete? @horizon_distance <= 0.3 end |
#to_h ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/legion/extensions/agentic/inference/horizon/helpers/projection.rb', line 33 def to_h { id: @id, description: @description, domain: @domain, horizon_distance: @horizon_distance.round(10), confidence: @confidence.round(10), construal_level: @construal_level, concrete: concrete?, abstract: abstract?, created_at: @created_at } end |