Module: OmniAI::Anthropic::Chat::ToolCallSerializer
- Defined in:
- lib/omniai/anthropic/chat/tool_call_serializer.rb
Overview
Overrides tool-call serialize / deserialize.
Class Method Summary collapse
Class Method Details
.deserialize(data, context:) ⇒ OmniAI::Chat::ToolCall
22 23 24 25 |
# File 'lib/omniai/anthropic/chat/tool_call_serializer.rb', line 22 def self.deserialize(data, context:) function = OmniAI::Chat::Function.deserialize(data, context:) OmniAI::Chat::ToolCall.new(id: data['id'], function:) end |
.serialize(tool_call, context:) ⇒ Hash
11 12 13 14 15 16 17 |
# File 'lib/omniai/anthropic/chat/tool_call_serializer.rb', line 11 def self.serialize(tool_call, context:) function = tool_call.function.serialize(context:) { id: tool_call.id, type: 'tool_use', }.merge(function) end |