Class: Legion::Extensions::Agentic::Defense::Dissonance::Helpers::Belief
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Defense::Dissonance::Helpers::Belief
- Defined in:
- lib/legion/extensions/agentic/defense/dissonance/helpers/belief.rb
Instance Attribute Summary collapse
-
#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.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#importance ⇒ Object
readonly
Returns the value of attribute importance.
Instance Method Summary collapse
- #contradicts?(other) ⇒ Boolean
-
#initialize(domain:, content:, confidence: 0.7, importance: :moderate) ⇒ Belief
constructor
A new instance of Belief.
- #to_h ⇒ Object
Constructor Details
#initialize(domain:, content:, confidence: 0.7, importance: :moderate) ⇒ Belief
Returns a new instance of Belief.
14 15 16 17 18 19 20 21 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/belief.rb', line 14 def initialize(domain:, content:, confidence: 0.7, importance: :moderate) @id = SecureRandom.uuid @domain = domain @content = content @confidence = confidence.clamp(0.0, 1.0) @importance = importance @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/defense/dissonance/helpers/belief.rb', line 12 def confidence @confidence end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/belief.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/defense/dissonance/helpers/belief.rb', line 12 def created_at @created_at end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/belief.rb', line 12 def domain @domain end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/belief.rb', line 12 def id @id end |
#importance ⇒ Object (readonly)
Returns the value of attribute importance.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/belief.rb', line 12 def importance @importance end |
Instance Method Details
#contradicts?(other) ⇒ Boolean
23 24 25 26 27 28 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/belief.rb', line 23 def contradicts?(other) return false if id == other.id return false unless domain == other.domain content.strip.downcase != other.content.strip.downcase end |
#to_h ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/legion/extensions/agentic/defense/dissonance/helpers/belief.rb', line 30 def to_h { id: id, domain: domain, content: content, confidence: confidence, importance: importance, created_at: created_at } end |