Class: OmniAI::Chat::Text
Overview
Just some text.
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(text = nil) ⇒ Text
constructor
A new instance of Text.
- #inspect ⇒ String
- #serialize(context: nil) ⇒ Hash
- #summarize ⇒ String
Methods inherited from Content
Constructor Details
#initialize(text = nil) ⇒ Text
Returns a new instance of Text.
11 12 13 14 |
# File 'lib/omniai/chat/text.rb', line 11 def initialize(text = nil) super() @text = text end |
Instance Attribute Details
#text ⇒ String
8 9 10 |
# File 'lib/omniai/chat/text.rb', line 8 def text @text end |
Class Method Details
.deserialize(data, context: nil) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/omniai/chat/text.rb', line 27 def self.deserialize(data, context: nil) deserialize = context&.deserializer(:text) return deserialize.call(data, context:) if deserialize new(data['text']) end |
Instance Method Details
#inspect ⇒ String
17 18 19 |
# File 'lib/omniai/chat/text.rb', line 17 def inspect "#<#{self.class} text=#{@text.inspect}>" end |
#serialize(context: nil) ⇒ Hash
37 38 39 40 41 42 |
# File 'lib/omniai/chat/text.rb', line 37 def serialize(context: nil) serializer = context&.serializer(:text) return serializer.call(self, context:) if serializer { type: 'text', text: @text } end |
#summarize ⇒ String
22 23 24 |
# File 'lib/omniai/chat/text.rb', line 22 def summarize @text end |