Method: Langchain::ToolDefinition#tool_name

Defined in:
lib/langchain/tool_definition.rb

#tool_nameString

Returns the snake_case version of the class name as the tool’s name

Returns:

  • (String)

    The snake_case version of the class name



57
58
59
60
61
62
# File 'lib/langchain/tool_definition.rb', line 57

def tool_name
  @tool_name ||= name
    .gsub("::", "_")
    .gsub(/(?<=[A-Z])(?=[A-Z][a-z])|(?<=[a-z\d])(?=[A-Z])/, "_")
    .downcase
end