Class: Legion::Extensions::Agentic::Attention::Blindspot::Helpers::KnowledgeBoundary
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Attention::Blindspot::Helpers::KnowledgeBoundary
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb
Constant Summary
Constants included from Constants
Constants::AWARENESS_LABELS, Constants::AWARENESS_THRESHOLD, Constants::COVERAGE_LABELS, Constants::DEFAULT_SEVERITY, Constants::DISCOVERY_METHODS, Constants::MAX_BLINDSPOTS, Constants::MAX_BOUNDARIES, Constants::SEVERITY_BOOST, Constants::SEVERITY_LABELS, Constants::STATUS_LABELS
Instance Attribute Summary collapse
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#coverage_estimate ⇒ Object
readonly
Returns the value of attribute coverage_estimate.
-
#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.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
- #coverage_label ⇒ Object
- #gap_detected?(error_occurred: false) ⇒ Boolean
-
#initialize(domain:, confidence: 0.5, coverage_estimate: 0.5) ⇒ KnowledgeBoundary
constructor
A new instance of KnowledgeBoundary.
- #to_h ⇒ Object
- #update_confidence!(new_confidence) ⇒ Object
- #update_coverage!(new_coverage) ⇒ Object
Methods included from Constants
Constructor Details
#initialize(domain:, confidence: 0.5, coverage_estimate: 0.5) ⇒ KnowledgeBoundary
Returns a new instance of KnowledgeBoundary.
16 17 18 19 20 21 22 23 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb', line 16 def initialize(domain:, confidence: 0.5, coverage_estimate: 0.5) @id = SecureRandom.uuid @domain = domain.to_sym @confidence = confidence.to_f.clamp(0.0, 1.0) @coverage_estimate = coverage_estimate.to_f.clamp(0.0, 1.0) @created_at = Time.now.utc @updated_at = Time.now.utc end |
Instance Attribute Details
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb', line 14 def confidence @confidence end |
#coverage_estimate ⇒ Object (readonly)
Returns the value of attribute coverage_estimate.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb', line 14 def coverage_estimate @coverage_estimate end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb', line 14 def created_at @created_at end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb', line 14 def domain @domain end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb', line 14 def id @id end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb', line 14 def updated_at @updated_at end |
Instance Method Details
#coverage_label ⇒ Object
25 26 27 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb', line 25 def coverage_label Constants.label_for(COVERAGE_LABELS, @coverage_estimate) || :minimal end |
#gap_detected?(error_occurred: false) ⇒ Boolean
29 30 31 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb', line 29 def gap_detected?(error_occurred: false) error_occurred && @confidence >= AWARENESS_THRESHOLD end |
#to_h ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb', line 45 def to_h { id: @id, domain: @domain, confidence: @confidence, coverage_estimate: @coverage_estimate, coverage_label: coverage_label, created_at: @created_at, updated_at: @updated_at } end |
#update_confidence!(new_confidence) ⇒ Object
33 34 35 36 37 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb', line 33 def update_confidence!(new_confidence) @confidence = new_confidence.to_f.clamp(0.0, 1.0) @updated_at = Time.now.utc self end |
#update_coverage!(new_coverage) ⇒ Object
39 40 41 42 43 |
# File 'lib/legion/extensions/agentic/attention/blindspot/helpers/knowledge_boundary.rb', line 39 def update_coverage!(new_coverage) @coverage_estimate = new_coverage.to_f.clamp(0.0, 1.0) @updated_at = Time.now.utc self end |