diff options
author | icebaker <icebaker@proton.me> | 2023-11-19 16:43:41 -0300 |
---|---|---|
committer | icebaker <icebaker@proton.me> | 2023-11-19 16:43:41 -0300 |
commit | 154aa68caf50a18af5c0dff1d368fc639314e0ba (patch) | |
tree | b2ab75665e42de79f22cca82bf03cfc49759f485 /spec | |
parent | e89a1d57c49c94c16c37a8ee3a69b52a9e2b341b (diff) |
improving tools parameters
Diffstat (limited to 'spec')
-rw-r--r-- | spec/data/cartridges/tools.yml | 5 | ||||
-rw-r--r-- | spec/logic/cartridge/tools_spec.rb | 8 | ||||
-rw-r--r-- | spec/logic/providers/openai/tools_spec.rb | 9 |
3 files changed, 18 insertions, 4 deletions
diff --git a/spec/data/cartridges/tools.yml b/spec/data/cartridges/tools.yml index 08164a4..3cbd1ea 100644 --- a/spec/data/cartridges/tools.yml +++ b/spec/data/cartridges/tools.yml @@ -39,3 +39,8 @@ tools: clojure: | (require '[clojure.java.shell :refer [sh]]) (println (apply sh (get parameters "command"))) + + - name: clock + description: Returns the current date and time. + fennel: | + (os.date) diff --git a/spec/logic/cartridge/tools_spec.rb b/spec/logic/cartridge/tools_spec.rb index 913fa62..d08817c 100644 --- a/spec/logic/cartridge/tools_spec.rb +++ b/spec/logic/cartridge/tools_spec.rb @@ -10,11 +10,11 @@ RSpec.describe NanoBot::Logic::Cartridge::Tools do let(:cartridge) { {} } it 'uses default values when appropriate' do - expect(described_class.feedback?(cartridge, :repl, :executing)).to be(true) - expect(described_class.feedback?(cartridge, :eval, :executing)).to be(true) + expect(described_class.feedback?(cartridge, :repl, :executing)).to be(false) + expect(described_class.feedback?(cartridge, :eval, :executing)).to be(false) - expect(described_class.feedback?(cartridge, :repl, :responding)).to be(false) - expect(described_class.feedback?(cartridge, :eval, :responding)).to be(false) + expect(described_class.feedback?(cartridge, :repl, :responding)).to be(true) + expect(described_class.feedback?(cartridge, :eval, :responding)).to be(true) end end diff --git a/spec/logic/providers/openai/tools_spec.rb b/spec/logic/providers/openai/tools_spec.rb index 1758e5f..949d097 100644 --- a/spec/logic/providers/openai/tools_spec.rb +++ b/spec/logic/providers/openai/tools_spec.rb @@ -59,6 +59,15 @@ RSpec.describe NanoBot::Logic::OpenAI::Tools do } } } ) + + expect(described_class.adapt(cartridge[:tools][3])).to eq( + { type: 'function', + function: { + name: 'clock', + description: 'Returns the current date and time.', + parameters: { type: 'object', properties: {} } + } } + ) end end |