Module: OmniAI::Anthropic::Chat::TextSerializer

Defined in:
lib/omniai/anthropic/chat/text_serializer.rb

Overview

Overrides text serialize / deserialize.

Class Method Summary collapse

Class Method Details

.deserialize(data) ⇒ OmniAI::Chat::Text

Parameters:

  • data (Hash)

Returns:

  • (OmniAI::Chat::Text)


16
17
18
# File 'lib/omniai/anthropic/chat/text_serializer.rb', line 16

def self.deserialize(data, *)
  OmniAI::Chat::Text.new(data['text'])
end

.serialize(text) ⇒ Hash

Parameters:

  • text (OmniAI::Chat::Text)

Returns:

  • (Hash)


10
11
12
# File 'lib/omniai/anthropic/chat/text_serializer.rb', line 10

def self.serialize(text, *)
  { type: 'text', text: text.text }
end