Class: SmartAgent::ToolContext

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_agent/tool.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tool) ⇒ ToolContext

Returns a new instance of ToolContext.



59
60
61
# File 'lib/smart_agent/tool.rb', line 59

def initialize(tool)
  @tool = tool
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



57
58
59
# File 'lib/smart_agent/tool.rb', line 57

def description
  @description
end

#input_paramsObject

Returns the value of attribute input_params.



57
58
59
# File 'lib/smart_agent/tool.rb', line 57

def input_params
  @input_params
end

#procObject

Returns the value of attribute proc.



57
58
59
# File 'lib/smart_agent/tool.rb', line 57

def proc
  @proc
end

Instance Method Details

#call_worker(name, params) ⇒ Object



75
76
77
78
# File 'lib/smart_agent/tool.rb', line 75

def call_worker(name, params)
  params[:with_history] = false
  SmartAgent.prompt_engine.call_worker(name, params)
end

#desc(description) ⇒ Object



71
72
73
# File 'lib/smart_agent/tool.rb', line 71

def desc(description)
  @description = description
end

#param_define(name, description, type) ⇒ Object



67
68
69
# File 'lib/smart_agent/tool.rb', line 67

def param_define(name, description, type)
  params[name] = { description: description, type: type }
end

#paramsObject



63
64
65
# File 'lib/smart_agent/tool.rb', line 63

def params
  @params ||= {}
end

#tool_proc(&block) ⇒ Object



80
81
82
# File 'lib/smart_agent/tool.rb', line 80

def tool_proc(&block)
  @proc = block
end