Class: Legion::Extensions::Agentic::Self::SelfModel::Helpers::KnowledgeDomain
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Self::SelfModel::Helpers::KnowledgeDomain
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb
Constant Summary
Constants included from Constants
Constants::CALIBRATION_ALPHA, Constants::CALIBRATION_LABELS, Constants::CAPABILITY_STATES, Constants::COMPETENCE_CEILING, Constants::COMPETENCE_FLOOR, Constants::CONFIDENCE_LABELS, Constants::DEFAULT_COMPETENCE, Constants::KNOWLEDGE_STATES, Constants::MAX_CAPABILITIES, Constants::MAX_HISTORY, Constants::MAX_KNOWLEDGE_DOMAINS, Constants::OVERCONFIDENCE_THRESHOLD, Constants::UNDERCONFIDENCE_THRESHOLD
Instance Attribute Summary collapse
-
#breadth ⇒ Object
readonly
Returns the value of attribute breadth.
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_accessed ⇒ Object
readonly
Returns the value of attribute last_accessed.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #access! ⇒ Object
- #broaden(amount:) ⇒ Object
- #deepen(amount:) ⇒ Object
-
#initialize(id:, name:, depth: 0.0, breadth: 0.0) ⇒ KnowledgeDomain
constructor
A new instance of KnowledgeDomain.
- #knowledge_label ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(id:, name:, depth: 0.0, breadth: 0.0) ⇒ KnowledgeDomain
Returns a new instance of KnowledgeDomain.
14 15 16 17 18 19 20 21 22 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 14 def initialize(id:, name:, depth: 0.0, breadth: 0.0) @id = id @name = name @depth = depth.to_f.clamp(0.0, 1.0) @breadth = breadth.to_f.clamp(0.0, 1.0) @last_accessed = nil @state = compute_state @confidence = average_score end |
Instance Attribute Details
#breadth ⇒ Object (readonly)
Returns the value of attribute breadth.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 12 def breadth @breadth end |
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 12 def confidence @confidence end |
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 12 def depth @depth end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 12 def id @id end |
#last_accessed ⇒ Object (readonly)
Returns the value of attribute last_accessed.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 12 def last_accessed @last_accessed end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 12 def name @name end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 12 def state @state end |
Instance Method Details
#access! ⇒ Object
36 37 38 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 36 def access! @last_accessed = Time.now.utc end |
#broaden(amount:) ⇒ Object
30 31 32 33 34 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 30 def broaden(amount:) @breadth = (@breadth + amount.to_f).clamp(0.0, 1.0) @state = compute_state @confidence = average_score end |
#deepen(amount:) ⇒ Object
24 25 26 27 28 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 24 def deepen(amount:) @depth = (@depth + amount.to_f).clamp(0.0, 1.0) @state = compute_state @confidence = average_score end |
#knowledge_label ⇒ Object
40 41 42 43 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 40 def knowledge_label CONFIDENCE_LABELS.each { |range, lbl| return lbl if range.cover?(@confidence) } :very_low end |
#to_h ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/legion/extensions/agentic/self/self_model/helpers/knowledge_domain.rb', line 45 def to_h { id: @id, name: @name, depth: @depth.round(4), breadth: @breadth.round(4), confidence: @confidence.round(4), state: @state, knowledge_label: knowledge_label, last_accessed: @last_accessed } end |