class Riffer::Messages::Assistant::ServerToolPart
A call or result of a tool the provider ran itself (e.g. web search). Stored and replayed verbatim under the same rule as reasoning parts: only the adapter whose format it is sends it back.
Constants
- KINDS
Attributes
The providerโs block, JSON-encoded and unchanged.
Shared by a call and its result.
Public Class Methods
Source
# File lib/riffer/messages/assistant/server_tool_part.rb, line 23 def self.from_hash(part) return part if part.is_a?(Riffer::Messages::Assistant::ServerToolPart) new( name: part[:name], kind: part[:kind].to_sym, data: part[:data], id: part[:id], format: part[:format], ) end
Source
# File lib/riffer/messages/assistant/server_tool_part.rb, line 37 def initialize(name:, kind:, data:, id: nil, format: nil) unless KINDS.include?(kind) raise Riffer::ArgumentError, "kind must be one of #{KINDS.inspect}, got #{kind.inspect}" end @name = name @kind = kind @data = data @id = id @format = format end
Public Instance Methods
Source
# File lib/riffer/messages/assistant/server_tool_part.rb, line 58 def ==(other) other.is_a?(Riffer::Messages::Assistant::ServerToolPart) && to_h == other.to_h end
Source
# File lib/riffer/messages/assistant/server_tool_part.rb, line 64 def eql?(other) self == other end
Source
# File lib/riffer/messages/assistant/server_tool_part.rb, line 70 def hash to_h.hash end
Source
# File lib/riffer/messages/assistant/server_tool_part.rb, line 52 def to_h { name: name, kind: kind, data: data, id: id, format: format }.compact end