Class: Botiasloop::Tool

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
lib/botiasloop/tool.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.tool_nameObject

Auto-generate tool name from class name in snake_case Example: WebSearch -> “web_search”, MyCustomTool -> “my_custom_tool”



9
10
11
12
13
14
15
16
# File 'lib/botiasloop/tool.rb', line 9

def self.tool_name
  name
    .split("::")
    .last
    .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
    .gsub(/([a-z\d])([A-Z])/, '\1_\2')
    .downcase
end

Instance Method Details

#nameObject

Override RubyLLM’s name method to use our tool_name This ensures the provider receives the correct tool name in schemas



20
21
22
# File 'lib/botiasloop/tool.rb', line 20

def name
  self.class.tool_name
end