Module: RobotLab::Durable::Learning

Defined in:
lib/robot_lab/durable/learning.rb

Instance Method Summary collapse

Instance Method Details

#run_reflectorObject

Run the end-of-session reflection pass. Called automatically from Robot#run when durable learning is active.



21
22
23
24
25
# File 'lib/robot_lab/durable/learning.rb', line 21

def run_reflector
  return unless @durable_store && @learn_domain && @learnings&.any?

  Reflector.new(store: @durable_store, domain: @learn_domain).reflect(@learnings)
end

#setup_durable_learning(domain:, store_path: nil) ⇒ Object

Configure durable learning on a robot after initialization.

Parameters:

  • domain (String)

    topic area for this robot’s knowledge

  • store_path (String, nil) (defaults to: nil)

    override default ~/.robot_lab/durable path



10
11
12
13
14
15
16
17
# File 'lib/robot_lab/durable/learning.rb', line 10

def setup_durable_learning(domain:, store_path: nil)
  @learn_domain  = domain.to_s
  opts           = store_path ? { path: store_path } : {}
  @durable_store = Store.new(**opts)

  seed_from_store
  @local_tools = (@local_tools + [RecallKnowledge, RecordKnowledge]).uniq
end