From e5fbef5525a0e7ea083cefb4010ebc9d97e02ab8 Mon Sep 17 00:00:00 2001 From: David Elner Date: Mon, 16 Nov 2026 11:11:55 -0500 Subject: [PATCH] Fixed: Breaking change for tool_calls in RubyLLM 2.2.0 --- lib/braintrust/contrib/ruby_llm/instrumentation/chat.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/braintrust/contrib/ruby_llm/instrumentation/chat.rb b/lib/braintrust/contrib/ruby_llm/instrumentation/chat.rb index bdb2d3e..bdba507 100644 --- a/lib/braintrust/contrib/ruby_llm/instrumentation/chat.rb +++ b/lib/braintrust/contrib/ruby_llm/instrumentation/chat.rb @@ -388,7 +388,8 @@ def format_attachment_for_input(attachment) # Format tool calls into OpenAI format def format_tool_calls(tool_calls) - tool_calls.map do |_id, tc| + # Both the pre-2.2 Hash and ToolCall::Collection expose values. + tool_calls.values.map do |tc| args = tc.arguments args_string = args.is_a?(String) ? args : JSON.generate(args)