class Riffer::Messages::Assistant::ToolCall
rbs_inline: enabled
Attributes
JSON-encoded, exactly as the provider emitted them.
Public Class Methods
Source
# File lib/riffer/messages/assistant/tool_call.rb, line 14 def self.from_hash(call) return call if call.is_a?(Riffer::Messages::Assistant::ToolCall) if call.values_at(:call_id, :name, :arguments).any?(&:nil?) raise Riffer::ArgumentError, "Tool call hash must include :call_id, :name, and :arguments" end new(call_id: call[:call_id], name: call[:name], arguments: call[:arguments]) end
Source
# File lib/riffer/messages/assistant/tool_call.rb, line 26 def initialize(call_id:, name:, arguments:) @call_id = call_id @name = name @arguments = arguments end
Public Instance Methods
Source
# File lib/riffer/messages/assistant/tool_call.rb, line 40 def ==(other) other.is_a?(Riffer::Messages::Assistant::ToolCall) && to_h == other.to_h end
Source
# File lib/riffer/messages/assistant/tool_call.rb, line 46 def eql?(other) self == other end
Source
# File lib/riffer/messages/assistant/tool_call.rb, line 34 def to_h { call_id: call_id, name: name, arguments: arguments } end