Module: OmniAI::Google::Chat::ContentSerializer

Defined in:
lib/omniai/google/chat/content_serializer.rb

Overview

Overrides content serialize / deserialize.

Class Method Summary collapse

Class Method Details

.deserialize(data, context:) ⇒ OmniAI::Chat::Text, OmniAI::Chat::ToolCall

Parameters:

  • data (Hash)
  • context (Context)

Returns:

  • (OmniAI::Chat::Text, OmniAI::Chat::ToolCall)


11
12
13
14
15
16
# File 'lib/omniai/google/chat/content_serializer.rb', line 11

def self.deserialize(data, context:)
  case
  when data['text'] then data['text']
  when data['functionCall'] then OmniAI::Chat::ToolCall.deserialize(data, context:)
  end
end