Skip to content

Commit 3091d51

Browse files
committed
Harden brittle parallel-tool assertion
1 parent 81793c3 commit 3091d51

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

spec/ruby_llm/chat_tools_spec.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,10 @@ def tool_result_message_for(chat, tool_call)
257257
expect(response.content).to include('15')
258258
expect(response.content).to include('10')
259259
expect(response.content).to include('Ruby')
260-
expect(chat.messages.count).to be(5)
260+
261+
# Some providers may still satisfy both tool calls with an additional turn.
262+
expect(chat.messages.count).to be >= 5
263+
expect(assistant_tool_call_messages(chat).sum { |message| message.tool_calls.size }).to be >= 2
261264
end
262265
end
263266

@@ -509,10 +512,9 @@ def tool_result_message_for(chat, tool_call)
509512
expect(tool_call.name).to eq('object_params')
510513

511514
arguments = stringified_arguments(tool_call.arguments)
512-
expect(arguments['window']).to include(
513-
'start' => '2025-01-01',
514-
'end' => '2025-01-02'
515-
)
515+
window = stringified_arguments(arguments['window'])
516+
expect(window['start']).to start_with('2025-01-01')
517+
expect(window['end']).to start_with('2025-01-02')
516518
end
517519
end
518520
end

0 commit comments

Comments
 (0)