diff options
Diffstat (limited to 'logic/providers/openai/tools.rb')
-rw-r--r-- | logic/providers/openai/tools.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/logic/providers/openai/tools.rb b/logic/providers/openai/tools.rb index 1b2882a..f00176c 100644 --- a/logic/providers/openai/tools.rb +++ b/logic/providers/openai/tools.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'json' +require 'babosa' require_relative '../../helpers/hash' @@ -17,7 +18,10 @@ module NanoBot tool = Helpers::Hash.symbolize_keys(tool) cartridge.each do |candidate| - next unless tool[:function][:name] == candidate[:name] + candidate_key = candidate[:name].to_slug.normalize.gsub('-', '_') + tool_key = tool[:function][:name].to_slug.normalize.gsub('-', '_') + + next unless candidate_key == tool_key source = {} @@ -27,6 +31,7 @@ module NanoBot applies << { id: tool[:id], + label: candidate[:name], name: tool[:function][:name], type: 'function', parameters: JSON.parse(tool[:function][:arguments]), |