module RubyLLM::Providers::OpenAI::Tools
def parse_tool_calls(tool_calls, parse_arguments: true) # rubocop:disable Metrics/MethodLength
def parse_tool_calls(tool_calls, parse_arguments: true) # rubocop:disable Metrics/MethodLength return nil unless tool_calls&.any? tool_calls.to_h do |tc| [ tc['id'], ToolCall.new( id: tc['id'], name: tc.dig('function', 'name'), arguments: if parse_arguments JSON.parse(tc.dig('function', 'arguments')) else tc.dig('function', 'arguments') end ) ] end end