Class: RubyLLM::Generators::ToolGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/ruby_llm/tool/tool_generator.rb

Overview

Generator for RubyLLM tool classes and related message partials.

Instance Method Summary collapse

Instance Method Details

#create_tool_fileObject



17
18
19
# File 'lib/generators/ruby_llm/tool/tool_generator.rb', line 17

def create_tool_file
  template 'tool.rb.tt', File.join('app/tools', class_path, "#{file_name}_tool.rb")
end

#create_tool_view_partialsObject



21
22
23
24
25
26
27
# File 'lib/generators/ruby_llm/tool/tool_generator.rb', line 21

def create_tool_view_partials
  empty_directory 'app/views/messages/tool_calls'
  empty_directory 'app/views/messages/tool_results'

  create_tool_call_partial
  create_tool_result_partial
end