From 154aa68caf50a18af5c0dff1d368fc639314e0ba Mon Sep 17 00:00:00 2001 From: icebaker Date: Sun, 19 Nov 2023 16:43:41 -0300 Subject: improving tools parameters --- logic/providers/openai/tools.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'logic') diff --git a/logic/providers/openai/tools.rb b/logic/providers/openai/tools.rb index 68f2209..1b2882a 100644 --- a/logic/providers/openai/tools.rb +++ b/logic/providers/openai/tools.rb @@ -41,13 +41,16 @@ module NanoBot end def self.adapt(cartridge) - { + output = { type: 'function', function: { - name: cartridge[:name], description: cartridge[:description], - parameters: cartridge[:parameters] + name: cartridge[:name], description: cartridge[:description] } } + + output[:function][:parameters] = (cartridge[:parameters] || { type: 'object', properties: {} }) + + output end end end -- cgit v1.2.3