Module: OmniAI::Google::Chat::ToolCallSerializer

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

Overview

Overrides tool-call serialize / deserialize.

Class Method Summary collapse

Class Method Details

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

Parameters:

  • data (Hash)
  • context (OmniAI::Context)

Returns:

  • (OmniAI::Chat::ToolCall)


18
19
20
21
# File 'lib/omniai/google/chat/tool_call_serializer.rb', line 18

def self.deserialize(data, context:)
  function = OmniAI::Chat::Function.deserialize(data['functionCall'], context:)
  OmniAI::Chat::ToolCall.new(id: function.name, function:)
end

.serialize(tool_call, context:) ⇒ Hash

Parameters:

  • tool_call (OmniAI::Chat::ToolCall)
  • context (OmniAI::Context)

Returns:

  • (Hash)


11
12
13
# File 'lib/omniai/google/chat/tool_call_serializer.rb', line 11

def self.serialize(tool_call, context:)
  { functionCall: tool_call.function.serialize(context:) }
end