class Riffer::Messages::Assistant::TextPart
rbs_inline: enabled
Attributes
The providerโs whole block as JSON, kept when it carries more than the text (e.g. Anthropic citations), so the adapter that produced it can send it back unchanged.
Public Class Methods
Source
# File lib/riffer/messages/assistant/text_part.rb, line 15 def self.from_hash(part) return part if part.is_a?(Riffer::Messages::Assistant::TextPart) new(part[:text].to_s, data: part[:data], format: part[:format]) end
Source
# File lib/riffer/messages/assistant/text_part.rb, line 23 def initialize(text, data: nil, format: nil) @text = text @data = data @format = format end
Public Instance Methods
Source
# File lib/riffer/messages/assistant/text_part.rb, line 37 def ==(other) other.is_a?(Riffer::Messages::Assistant::TextPart) && to_h == other.to_h end
Source
# File lib/riffer/messages/assistant/text_part.rb, line 43 def eql?(other) self == other end
Source
# File lib/riffer/messages/assistant/text_part.rb, line 31 def to_h { text: text, data: data, format: format }.compact end