Class: RobotLab::RecordKnowledge

Inherits:
Tool
  • Object
show all
Defined in:
lib/robot_lab/record_knowledge.rb

Instance Method Summary collapse

Instance Method Details

#execute(content:, reasoning:, category:, domain:) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/robot_lab/record_knowledge.rb', line 15

def execute(content:, reasoning:, category:, domain:)
  store = robot&.durable_store
  return "No durable store configured on this robot." unless store

  now = Time.now.iso8601
  entry = Durable::Entry.new(
    content:,
    reasoning:,
    category:   category.to_sym,
    domain:,
    confidence: 0.1,
    use_count:  0,
    created_at: now,
    updated_at: now
  )

  store.record(entry)
  robot.learn("#{content} (#{domain})")

  "Recorded: #{content}"
end