Module: Legion::Extensions::Agentic::Attention::FeatureBinding::Runners::FeatureBinding
- Includes:
- Helpers::Lex
- Included in:
- Client
- Defined in:
- lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb
Instance Method Summary collapse
- #attend_object(object_id:) ⇒ Object
- #bind_features(feature_ids:, attention: false) ⇒ Object
- #feature_binding_stats ⇒ Object
- #features_of_object(object_id:) ⇒ Object
- #illusory_conjunctions ⇒ Object
- #objects_with(feature_id:) ⇒ Object
- #register_feature(id:, dimension:, value:, source: :perception, salience: 0.5) ⇒ Object
- #search_features(dimension:, value: nil) ⇒ Object
- #unbind_object(object_id:) ⇒ Object
- #unbound_features ⇒ Object
- #update_feature_binding ⇒ Object
Instance Method Details
#attend_object(object_id:) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb', line 34 def attend_object(object_id:, **) log.debug("[feature_binding] attend: object=#{object_id}") obj = field.attend(object_id: object_id.to_sym) if obj { success: true, object: obj.to_h } else { success: false, reason: :not_found } end end |
#bind_features(feature_ids:, attention: false) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb', line 24 def bind_features(feature_ids:, attention: false, **) log.debug("[feature_binding] bind: features=#{feature_ids} attention=#{attention}") obj = field.bind(feature_ids: feature_ids, attention: attention) if obj { success: true, object: obj.to_h, total_objects: field.object_count } else { success: false, reason: :insufficient_features } end end |
#feature_binding_stats ⇒ Object
86 87 88 89 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb', line 86 def feature_binding_stats(**) log.debug('[feature_binding] stats') { success: true, stats: field.to_h } end |
#features_of_object(object_id:) ⇒ Object
50 51 52 53 54 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb', line 50 def features_of_object(object_id:, **) features = field.features_of(object_id: object_id.to_sym) log.debug("[feature_binding] features_of: object=#{object_id} count=#{features.size}") { success: true, features: features, count: features.size } end |
#illusory_conjunctions ⇒ Object
62 63 64 65 66 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb', line 62 def illusory_conjunctions(**) illusions = field.illusory_conjunctions log.debug("[feature_binding] illusory: #{illusions.size}") { success: true, illusory: illusions, count: illusions.size } end |
#objects_with(feature_id:) ⇒ Object
56 57 58 59 60 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb', line 56 def objects_with(feature_id:, **) objects = field.objects_with_feature(feature_id: feature_id) log.debug("[feature_binding] objects_with: feature=#{feature_id} count=#{objects.size}") { success: true, objects: objects, count: objects.size } end |
#register_feature(id:, dimension:, value:, source: :perception, salience: 0.5) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb', line 13 def register_feature(id:, dimension:, value:, source: :perception, salience: 0.5, **) log.debug("[feature_binding] register: id=#{id} dim=#{dimension} val=#{value}") feature = field.register_feature(id: id, dimension: dimension, value: value, source: source, salience: salience) if feature { success: true, feature: feature.to_h, total_features: field.feature_count } else { success: false, reason: :limit_reached } end end |
#search_features(dimension:, value: nil) ⇒ Object
74 75 76 77 78 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb', line 74 def search_features(dimension:, value: nil, **) results = field.search_by_dimension(dimension: dimension, value: value) log.debug("[feature_binding] search: dim=#{dimension} found=#{results.size}") { success: true, results: results, count: results.size } end |
#unbind_object(object_id:) ⇒ Object
44 45 46 47 48 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb', line 44 def unbind_object(object_id:, **) log.debug("[feature_binding] unbind: object=#{object_id}") removed = field.unbind(object_id: object_id.to_sym) { success: removed } end |
#unbound_features ⇒ Object
68 69 70 71 72 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb', line 68 def unbound_features(**) unbound = field.unbound_features log.debug("[feature_binding] unbound: #{unbound.size}") { success: true, unbound: unbound, count: unbound.size } end |
#update_feature_binding ⇒ Object
80 81 82 83 84 |
# File 'lib/legion/extensions/agentic/attention/feature_binding/runners/feature_binding.rb', line 80 def update_feature_binding(**) log.debug('[feature_binding] tick') field.decay_all { success: true, features: field.feature_count, objects: field.object_count } end |