Class: RubyLLM::Tool::Builder

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

Instance Method Summary collapse

Constructor Details

#initialize(tool) ⇒ Builder

Returns a new instance of Builder.



25
26
27
# File 'lib/ruby_llm/tool.rb', line 25

def initialize(tool)
  @tool = tool
end

Instance Method Details

#description(text) ⇒ Object



29
30
31
32
# File 'lib/ruby_llm/tool.rb', line 29

def description(text)
  @tool.instance_variable_set(:@description, text)
  self
end

#handler(&block) ⇒ Object



39
40
41
42
# File 'lib/ruby_llm/tool.rb', line 39

def handler(&block)
  @tool.instance_variable_set(:@handler, block)
  @tool
end

#param(name, type: 'string', description: nil, required: true) ⇒ Object



34
35
36
37
# File 'lib/ruby_llm/tool.rb', line 34

def param(name, type: 'string', description: nil, required: true)
  @tool.parameters[name] = Parameter.new(name, type: type, description: description, required: required)
  self
end