Module: OmniAI::Anthropic::Chat::ContentSerializer

Defined in:
lib/omniai/anthropic/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/anthropic/chat/content_serializer.rb', line 11

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