Class: Tools::Enabler

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/shared_tools/tools/enabler.rb

Overview

A tool for reading the contents of a file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent) ⇒ Enabler

param :params, desc: ‘JSON formatted parameters’



30
31
32
# File 'lib/shared_tools/tools/enabler.rb', line 30

def initialize(agent)
  @agent = agent
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



22
23
24
# File 'lib/shared_tools/tools/enabler.rb', line 22

def agent
  @agent
end

Instance Method Details

#execute(tool:, params: '') ⇒ Object



34
35
36
37
38
39
40
# File 'lib/shared_tools/tools/enabler.rb', line 34

def execute(tool:, params: '')
  agent.add_tool(tool)
  # TODO: call the tool with the params and return the result.
  { success: true }
rescue StandardError => e
  { error: e.message }
end