Module: OmniAI::Anthropic::Chat::ToolSerializer

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

Overview

Overrides tool serialize / deserialize.

Class Method Summary collapse

Class Method Details

.serialize(tool) ⇒ Hash

Parameters:

  • tool (OmniAI::Tool)

Returns:

  • (Hash)


10
11
12
13
14
15
16
# File 'lib/omniai/anthropic/chat/tool_serializer.rb', line 10

def self.serialize(tool, *)
  {
    name: tool.name,
    description: tool.description,
    input_schema: tool.parameters.is_a?(Tool::Parameters) ? tool.parameters.serialize : tool.parameters,
  }.compact
end