Module: Legion::Extensions::Agentic::Memory::SemanticSatiation::Runners::SemanticSatiation
- Includes:
- Helpers::Lex
- Included in:
- Client
- Defined in:
- lib/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation.rb
Instance Method Summary collapse
- #domain_satiation(domain:) ⇒ Object
- #expose(label:, domain: :general) ⇒ Object
- #expose_by_id(concept_id:) ⇒ Object
- #freshest_concepts(limit: 5) ⇒ Object
- #most_exposed(limit: 5) ⇒ Object
- #novelty_report ⇒ Object
- #prune_saturated ⇒ Object
- #recover(amount: Helpers::Constants::RECOVERY_RATE) ⇒ Object
- #register(label:, domain: :general) ⇒ Object
- #satiation_status ⇒ Object
Instance Method Details
#domain_satiation(domain:) ⇒ Object
50 51 52 53 54 |
# File 'lib/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation.rb', line 50 def domain_satiation(domain:, **) avg_fluency = satiation_engine.domain_satiation(domain: domain) log.debug("[semantic_satiation] domain_satiation: domain=#{domain} avg_fluency=#{avg_fluency.round(2)}") { domain: domain, avg_fluency: avg_fluency } end |
#expose(label:, domain: :general) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation.rb', line 13 def expose(label:, domain: :general, **) result = satiation_engine.expose_by_label(label: label, domain: domain) log.debug("[semantic_satiation] expose: label=#{label} domain=#{domain} " \ "fluency=#{result[:fluency]&.round(2)} satiated=#{result[:satiated]}") result end |
#expose_by_id(concept_id:) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation.rb', line 26 def expose_by_id(concept_id:, **) result = satiation_engine.expose_concept(concept_id: concept_id) if result[:error] log.debug("[semantic_satiation] expose_by_id: not found id=#{concept_id[0..7]}") else log.debug("[semantic_satiation] expose_by_id: id=#{concept_id[0..7]} " \ "fluency=#{result[:fluency]&.round(2)}") end result end |
#freshest_concepts(limit: 5) ⇒ Object
62 63 64 65 66 |
# File 'lib/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation.rb', line 62 def freshest_concepts(limit: 5, **) concepts = satiation_engine.freshest(limit: limit) log.debug("[semantic_satiation] freshest: limit=#{limit} found=#{concepts.size}") { concepts: concepts.map(&:to_h), count: concepts.size } end |
#most_exposed(limit: 5) ⇒ Object
56 57 58 59 60 |
# File 'lib/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation.rb', line 56 def most_exposed(limit: 5, **) concepts = satiation_engine.most_exposed(limit: limit) log.debug("[semantic_satiation] most_exposed: limit=#{limit} found=#{concepts.size}") { concepts: concepts.map(&:to_h), count: concepts.size } end |
#novelty_report ⇒ Object
68 69 70 71 72 73 |
# File 'lib/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation.rb', line 68 def novelty_report(**) report = satiation_engine.novelty_report total = satiation_engine.concepts.size log.debug("[semantic_satiation] novelty_report: total=#{total}") { distribution: report, total: total } end |
#prune_saturated ⇒ Object
75 76 77 78 79 |
# File 'lib/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation.rb', line 75 def prune_saturated(**) removed = satiation_engine.prune_saturated log.debug("[semantic_satiation] prune_saturated: removed=#{removed}") { removed: removed } end |
#recover(amount: Helpers::Constants::RECOVERY_RATE) ⇒ Object
37 38 39 40 41 |
# File 'lib/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation.rb', line 37 def recover(amount: Helpers::Constants::RECOVERY_RATE, **) result = satiation_engine.recover_all log.debug("[semantic_satiation] recover: amount=#{amount} recovered=#{result[:recovered]}") result end |
#register(label:, domain: :general) ⇒ Object
20 21 22 23 24 |
# File 'lib/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation.rb', line 20 def register(label:, domain: :general, **) concept = satiation_engine.register_concept(label: label, domain: domain) log.debug("[semantic_satiation] register: label=#{label} domain=#{domain} id=#{concept.id[0..7]}") concept.to_h end |
#satiation_status ⇒ Object
43 44 45 46 47 48 |
# File 'lib/legion/extensions/agentic/memory/semantic_satiation/runners/semantic_satiation.rb', line 43 def satiation_status(**) summary = satiation_engine.to_h log.debug("[semantic_satiation] status: concepts=#{summary[:concept_count]} " \ "satiated=#{summary[:satiated_count]}") summary end |