Class: Botiasloop::Tool
- Inherits:
-
RubyLLM::Tool
- Object
- RubyLLM::Tool
- Botiasloop::Tool
- Defined in:
- lib/botiasloop/tool.rb
Direct Known Subclasses
Class Method Summary collapse
-
.tool_name ⇒ Object
Auto-generate tool name from class name in snake_case Example: WebSearch -> “web_search”, MyCustomTool -> “my_custom_tool”.
Instance Method Summary collapse
-
#name ⇒ Object
Override RubyLLM’s name method to use our tool_name This ensures the provider receives the correct tool name in schemas.
Class Method Details
.tool_name ⇒ Object
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
#name ⇒ Object
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 |