Module: OmniAI::Google::Chat::FunctionSerializer

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

Overview

Overrides function serialize / deserialize.

Class Method Summary collapse

Class Method Details

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

Parameters:

  • data (Hash)

Returns:

  • (OmniAI::Chat::Function)


19
20
21
22
23
# File 'lib/omniai/google/chat/function_serializer.rb', line 19

def self.deserialize(data, *)
  name = data['name']
  arguments = data['args']
  OmniAI::Chat::Function.new(name:, arguments:)
end

.serialize(function) ⇒ Hash

Parameters:

  • function (OmniAI::Chat::Function)

Returns:

  • (Hash)


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

def self.serialize(function, *)
  {
    name: function.name,
    args: function.arguments,
  }
end