Class: Llm::Functions::GetGemFilesList
- Defined in:
- lib/llm/functions/get_gem_files_list.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Class Method Details
.gem_name_enums ⇒ Object
8 9 10 |
# File 'lib/llm/functions/get_gem_files_list.rb', line 8 def self.gem_name_enums @gem_name_enums ||= ::Bundler.locked_gems.specs.map(&:full_name) end |
Instance Method Details
#definition ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/llm/functions/get_gem_files_list.rb', line 12 def definition return @definition unless @definition.nil? @definition = { name: self.function_name, description: I18n.t("ghostest.functions.#{self.function_name}.description"), parameters: { type: :object, properties: { gem_name: { type: :string, description: I18n.t("ghostest.functions.#{self.function_name}.parameters.gem_name"), enum: self.class.gem_name_enums, }, }, required: [:gem_name], }, } @definition end |
#execute_and_generate_message(args) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/llm/functions/get_gem_files_list.rb', line 33 def (args) unless self.class.gem_name_enums.include?(args['gem_name']) return { message: 'invalid gem_name. gem_name is below' + self.class.gem_name_enums.join("\n") } end files_list = Dir.glob("#{Gem.paths.home}/gems/#{args['gem_name']}/**/*.{rb,yml}") { files_list: } end |
#function_name ⇒ Object
4 5 6 |
# File 'lib/llm/functions/get_gem_files_list.rb', line 4 def function_name :get_gem_files_list end |