class Riffer::Messages::Assistant::ReasoningPart
Stored and replayed verbatim, never interpreted, so a provider that requires its own thinking blocks back gets them unchanged.
Constants
- TYPES
Attributes
Owned by the producing adapter (e.g. "anthropic-messages-v1"); adapters replay only the formats they recognize, so it is never validated here.
Public Class Methods
Source
# File lib/riffer/messages/assistant/reasoning_part.rb, line 21 def self.from_hash(part) return part if part.is_a?(Riffer::Messages::Assistant::ReasoningPart) new( type: part[:type].to_sym, text: part[:text], data: part[:data], signature: part[:signature], id: part[:id], format: part[:format], ) end
Source
# File lib/riffer/messages/assistant/reasoning_part.rb, line 36 def initialize(type:, text: nil, data: nil, signature: nil, id: nil, format: nil) unless TYPES.include?(type) raise Riffer::ArgumentError, "type must be one of #{TYPES.inspect}, got #{type.inspect}" end @type = type @text = text @data = data @signature = signature @id = id @format = format end
Public Instance Methods
Source
# File lib/riffer/messages/assistant/reasoning_part.rb, line 58 def ==(other) other.is_a?(Riffer::Messages::Assistant::ReasoningPart) && to_h == other.to_h end
Source
# File lib/riffer/messages/assistant/reasoning_part.rb, line 64 def eql?(other) self == other end
Source
# File lib/riffer/messages/assistant/reasoning_part.rb, line 70 def hash to_h.hash end
Source
# File lib/riffer/messages/assistant/reasoning_part.rb, line 52 def to_h { type: type, text: text, data: data, signature: signature, id: id, format: format }.compact end