Class: Legion::Extensions::Agentic::Inference::BeliefRevision::Helpers::Evidence
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Inference::BeliefRevision::Helpers::Evidence
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/inference/belief_revision/helpers/evidence.rb
Constant Summary
Constants included from Constants
Constants::BELIEF_STATES, Constants::CONTRADICTION_THRESHOLD, Constants::CREDENCE_CEILING, Constants::CREDENCE_FLOOR, Constants::CREDENCE_LABELS, Constants::DECAY_RATE, Constants::DEFAULT_CREDENCE, Constants::ENTRENCHMENT_ALPHA, Constants::EVIDENCE_TYPES, Constants::EVIDENCE_WEIGHT, Constants::LINK_TYPES, Constants::MAX_BELIEFS, Constants::MAX_EVIDENCE_PER_BELIEF, Constants::MAX_HISTORY, Constants::MAX_LINKS, Constants::STATE_THRESHOLDS
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#evidence_type ⇒ Object
readonly
Returns the value of attribute evidence_type.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(id:, evidence_type:, content:, weight: EVIDENCE_WEIGHT, source: :unknown) ⇒ Evidence
constructor
A new instance of Evidence.
- #strong? ⇒ Boolean
- #to_h ⇒ Object
- #weak? ⇒ Boolean
Constructor Details
#initialize(id:, evidence_type:, content:, weight: EVIDENCE_WEIGHT, source: :unknown) ⇒ Evidence
Returns a new instance of Evidence.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/legion/extensions/agentic/inference/belief_revision/helpers/evidence.rb', line 14 def initialize(id:, evidence_type:, content:, weight: EVIDENCE_WEIGHT, source: :unknown) raise ArgumentError, "invalid type: #{evidence_type}" unless EVIDENCE_TYPES.include?(evidence_type) @id = id @evidence_type = evidence_type @content = content @weight = weight.to_f.clamp(0.0, 1.0) @source = source @created_at = Time.now.utc end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/belief_revision/helpers/evidence.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/inference/belief_revision/helpers/evidence.rb', line 12 def created_at @created_at end |
#evidence_type ⇒ Object (readonly)
Returns the value of attribute evidence_type.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/belief_revision/helpers/evidence.rb', line 12 def evidence_type @evidence_type end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/belief_revision/helpers/evidence.rb', line 12 def id @id end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/belief_revision/helpers/evidence.rb', line 12 def source @source end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
12 13 14 |
# File 'lib/legion/extensions/agentic/inference/belief_revision/helpers/evidence.rb', line 12 def weight @weight end |
Instance Method Details
#strong? ⇒ Boolean
25 26 27 |
# File 'lib/legion/extensions/agentic/inference/belief_revision/helpers/evidence.rb', line 25 def strong? @weight >= 0.5 end |
#to_h ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/legion/extensions/agentic/inference/belief_revision/helpers/evidence.rb', line 33 def to_h { id: @id, evidence_type: @evidence_type, content: @content, weight: @weight.round(4), source: @source, created_at: @created_at } end |
#weak? ⇒ Boolean
29 30 31 |
# File 'lib/legion/extensions/agentic/inference/belief_revision/helpers/evidence.rb', line 29 def weak? @weight < 0.2 end |