Module: OmniAI::Anthropic::Chat::ToolCallResultSerializer
- Defined in:
- lib/omniai/anthropic/chat/tool_call_result_serializer.rb
Overview
Overrides tool-call response serialize / deserialize.
Class Method Summary collapse
Class Method Details
.deserialize(data) ⇒ OmniAI::Chat::ToolCallResult
22 23 24 25 26 27 |
# File 'lib/omniai/anthropic/chat/tool_call_result_serializer.rb', line 22 def self.deserialize(data, *) tool_call_id = data["tool_use_id"] content = data["content"] OmniAI::Chat::ToolCallResult.new(content:, tool_call_id:) end |
.serialize(tool_call_result) ⇒ Hash
11 12 13 14 15 16 17 |
# File 'lib/omniai/anthropic/chat/tool_call_result_serializer.rb', line 11 def self.serialize(tool_call_result, *) { type: "tool_result", tool_use_id: tool_call_result.tool_call_id, content: tool_call_result.text, } end |