Class: Legion::Extensions::Agentic::Learning::EpistemicCuriosity::Helpers::KnowledgeGap
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Learning::EpistemicCuriosity::Helpers::KnowledgeGap
- Defined in:
- lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#explorations ⇒ Object
readonly
Returns the value of attribute explorations.
-
#gap_type ⇒ Object
readonly
Returns the value of attribute gap_type.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#question ⇒ Object
readonly
Returns the value of attribute question.
-
#resolved_at ⇒ Object
Returns the value of attribute resolved_at.
-
#satisfaction ⇒ Object
Returns the value of attribute satisfaction.
-
#urgency ⇒ Object
Returns the value of attribute urgency.
Instance Method Summary collapse
- #decay! ⇒ Object
- #explore! ⇒ Object
-
#initialize(id:, question:, domain:, gap_type:, urgency: Constants::DEFAULT_URGENCY) ⇒ KnowledgeGap
constructor
A new instance of KnowledgeGap.
- #resolved? ⇒ Boolean
- #satisfy!(amount: 0.3) ⇒ Object
- #to_h ⇒ Object
- #urgency_label ⇒ Object
Constructor Details
#initialize(id:, question:, domain:, gap_type:, urgency: Constants::DEFAULT_URGENCY) ⇒ KnowledgeGap
Returns a new instance of KnowledgeGap.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 13 def initialize(id:, question:, domain:, gap_type:, urgency: Constants::DEFAULT_URGENCY) @id = id @question = question @domain = domain @gap_type = gap_type @urgency = urgency.clamp(0.0, 1.0) @satisfaction = 0.0 @explorations = 0 @created_at = Time.now.utc @resolved_at = nil end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 10 def created_at @created_at end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
10 11 12 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 10 def domain @domain end |
#explorations ⇒ Object (readonly)
Returns the value of attribute explorations.
10 11 12 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 10 def explorations @explorations end |
#gap_type ⇒ Object (readonly)
Returns the value of attribute gap_type.
10 11 12 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 10 def gap_type @gap_type end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 10 def id @id end |
#question ⇒ Object (readonly)
Returns the value of attribute question.
10 11 12 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 10 def question @question end |
#resolved_at ⇒ Object
Returns the value of attribute resolved_at.
11 12 13 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 11 def resolved_at @resolved_at end |
#satisfaction ⇒ Object
Returns the value of attribute satisfaction.
11 12 13 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 11 def satisfaction @satisfaction end |
#urgency ⇒ Object
Returns the value of attribute urgency.
11 12 13 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 11 def urgency @urgency end |
Instance Method Details
#decay! ⇒ Object
44 45 46 47 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 44 def decay! @urgency = (@urgency - Constants::URGENCY_DECAY).clamp(0.0, 1.0) self end |
#explore! ⇒ Object
25 26 27 28 29 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 25 def explore! @explorations += 1 @urgency = (@urgency + Constants::URGENCY_BOOST).clamp(0.0, 1.0) self end |
#resolved? ⇒ Boolean
36 37 38 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 36 def resolved? @satisfaction >= Constants::SATISFACTION_THRESHOLD end |
#satisfy!(amount: 0.3) ⇒ Object
31 32 33 34 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 31 def satisfy!(amount: 0.3) @satisfaction = (@satisfaction + amount).clamp(0.0, 1.0) self end |
#to_h ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 49 def to_h { id: @id, question: @question, domain: @domain, gap_type: @gap_type, urgency: @urgency.round(4), urgency_label: urgency_label, satisfaction: @satisfaction.round(4), explorations: @explorations, resolved: resolved?, created_at: @created_at, resolved_at: @resolved_at } end |
#urgency_label ⇒ Object
40 41 42 |
# File 'lib/legion/extensions/agentic/learning/epistemic_curiosity/helpers/knowledge_gap.rb', line 40 def urgency_label Constants::URGENCY_LABELS.find { |entry| entry[:range].cover?(@urgency) }&.fetch(:label, :mild) || :mild end |