Class: RobotLab::Durable::Adapter
- Inherits:
-
Object
- Object
- RobotLab::Durable::Adapter
- Defined in:
- lib/robot_lab/durable/adapter.rb
Instance Attribute Summary collapse
-
#htm ⇒ Object
readonly
Returns the value of attribute htm.
Instance Method Summary collapse
-
#initialize(robot_name:) ⇒ Adapter
constructor
A new instance of Adapter.
-
#recall(query:, limit: 20, strategy: :hybrid) ⇒ Array<Entry>
Recall entries relevant to a query using HTM hybrid search.
-
#record(content:, reasoning: nil, category: 'fact') ⇒ Integer
Store content in HTM long-term memory.
Constructor Details
#initialize(robot_name:) ⇒ Adapter
Returns a new instance of Adapter.
10 11 12 |
# File 'lib/robot_lab/durable/adapter.rb', line 10 def initialize(robot_name:) @htm = HTM.new(robot_name: robot_name) end |
Instance Attribute Details
#htm ⇒ Object (readonly)
Returns the value of attribute htm.
8 9 10 |
# File 'lib/robot_lab/durable/adapter.rb', line 8 def htm @htm end |
Instance Method Details
#recall(query:, limit: 20, strategy: :hybrid) ⇒ Array<Entry>
Recall entries relevant to a query using HTM hybrid search.
20 21 22 23 |
# File 'lib/robot_lab/durable/adapter.rb', line 20 def recall(query:, limit: 20, strategy: :hybrid) nodes = @htm.recall(query, limit: limit, strategy: strategy, raw: true) nodes.map { |node| Entry.from_node(node) } end |
#record(content:, reasoning: nil, category: 'fact') ⇒ Integer
Store content in HTM long-term memory.
31 32 33 34 35 36 37 38 39 |
# File 'lib/robot_lab/durable/adapter.rb', line 31 def record(content:, reasoning: nil, category: 'fact') @htm.remember( content, metadata: { 'reasoning' => reasoning, 'category' => category.to_s } ) end |