Skip to content

Commit 486118d

Browse files
committed
test: chat tool spec cycle through provider for each test in order to decrease rate limit probability
1 parent e2edea7 commit 486118d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

spec/ruby_llm/chat_tools_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ def execute
4848
expect(response.content).to include('15')
4949
expect(response.content).to include('10')
5050
end
51+
end
5152

53+
chat_models.each do |model| # rubocop:disable Style/CombinableLoops
54+
provider = RubyLLM::Models.provider_for(model).slug
5255
it "#{provider}/#{model} can use tools in multi-turn conversations" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations
5356
chat = RubyLLM.chat(model: model)
5457
.with_tool(Weather)
@@ -61,13 +64,19 @@ def execute
6164
expect(response.content).to include('15')
6265
expect(response.content).to include('10')
6366
end
67+
end
6468

69+
chat_models.each do |model| # rubocop:disable Style/CombinableLoops
70+
provider = RubyLLM::Models.provider_for(model).slug
6571
it "#{provider}/#{model} can use tools without parameters" do
6672
chat = RubyLLM.chat(model: model).with_tool(BestLanguageToLearn)
6773
response = chat.ask("What's the best language to learn?")
6874
expect(response.content).to include('Ruby')
6975
end
76+
end
7077

78+
chat_models.each do |model| # rubocop:disable Style/CombinableLoops
79+
provider = RubyLLM::Models.provider_for(model).slug
7180
it "#{provider}/#{model} can use tools without parameters in multi-turn streaming conversations" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations
7281
chat = RubyLLM.chat(model: model).with_tool(BestLanguageToLearn)
7382
chunks = []
@@ -88,7 +97,10 @@ def execute
8897
expect(chunks.first).to be_a(RubyLLM::Chunk)
8998
expect(response.content).to include('Ruby')
9099
end
100+
end
91101

102+
chat_models.each do |model| # rubocop:disable Style/CombinableLoops
103+
provider = RubyLLM::Models.provider_for(model).slug
92104
it "#{provider}/#{model} can use tools with multi-turn streaming conversations" do # rubocop:disable RSpec/ExampleLength,RSpec/MultipleExpectations
93105
chat = RubyLLM.chat(model: model)
94106
.with_tool(Weather)

0 commit comments

Comments
 (0)