Class: Mistri::Content::Text

Inherits:
Data
  • Object
show all
Defined in:
lib/mistri/content.rb

Overview

signature carries opaque provider metadata that must round-trip, such as the OpenAI Responses message id and output phase.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text:, signature: nil) ⇒ Text

Returns a new instance of Text.



20
21
22
23
# File 'lib/mistri/content.rb', line 20

def initialize(text:, signature: nil)
  signature = Content.freeze_string(signature) if signature.is_a?(String)
  super(text: Content.freeze_string(text), signature:)
end

Instance Attribute Details

#signatureObject (readonly)

Returns the value of attribute signature

Returns:

  • (Object)

    the current value of signature



19
20
21
# File 'lib/mistri/content.rb', line 19

def signature
  @signature
end

#textObject (readonly)

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



19
20
21
# File 'lib/mistri/content.rb', line 19

def text
  @text
end

Instance Method Details

#to_hObject



27
# File 'lib/mistri/content.rb', line 27

def to_h = { type: :text, text:, signature: }.compact

#typeObject



25
# File 'lib/mistri/content.rb', line 25

def type = :text