From c19e6487fee8af964c2ed6a9daf39d5a5dea5458 Mon Sep 17 00:00:00 2001 From: Imtiaz Mukadam Date: Sun, 10 Aug 2025 20:32:57 +0200 Subject: [PATCH 1/2] fix: remove tool_call auto param Open ai defaults to auto when tools are present. This allows the param to be overwritten with `with_params` --- lib/ruby_llm/providers/openai/chat.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/ruby_llm/providers/openai/chat.rb b/lib/ruby_llm/providers/openai/chat.rb index 98151e0e6..70f0dece5 100644 --- a/lib/ruby_llm/providers/openai/chat.rb +++ b/lib/ruby_llm/providers/openai/chat.rb @@ -23,7 +23,6 @@ def render_payload(messages, tools:, temperature:, model:, stream: false, schema if tools.any? payload[:tools] = tools.map { |_, tool| tool_for(tool) } - payload[:tool_choice] = 'auto' end if schema From 80b134b0317c53ce71c130f32d242886fd05679b Mon Sep 17 00:00:00 2001 From: Carmine Paolino Date: Tue, 12 Aug 2025 13:16:59 +0200 Subject: [PATCH 2/2] Fix rubocop issue --- lib/ruby_llm/providers/openai/chat.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/ruby_llm/providers/openai/chat.rb b/lib/ruby_llm/providers/openai/chat.rb index 70f0dece5..9ed7e170b 100644 --- a/lib/ruby_llm/providers/openai/chat.rb +++ b/lib/ruby_llm/providers/openai/chat.rb @@ -21,9 +21,7 @@ def render_payload(messages, tools:, temperature:, model:, stream: false, schema # Only include temperature if it's not nil (some models don't accept it) payload[:temperature] = temperature unless temperature.nil? - if tools.any? - payload[:tools] = tools.map { |_, tool| tool_for(tool) } - end + payload[:tools] = tools.map { |_, tool| tool_for(tool) } if tools.any? if schema # Use strict mode from schema if specified, default to true