class Riffer::Messages::Tool
rbs_inline: enabled
Attributes
Public Class Methods
Source
# File lib/riffer/messages/tool.rb, line 7 def self.from_hash(msg) return msg if msg.is_a?(Riffer::Messages::Tool) new( msg[:content], id: msg[:id], tool_call_id: msg[:tool_call_id], name: msg[:name], error: msg[:error], error_type: msg[:error_type]&.to_sym, ) end
Source
# File lib/riffer/messages/tool.rb, line 27 def initialize(content, tool_call_id:, name:, id: nil, error: nil, error_type: nil) super(content, id: id) @tool_call_id = tool_call_id @name = name @error = error @error_type = error_type end
Calls superclass method
Riffer::Messages::Base::new
Public Instance Methods
Source
# File lib/riffer/messages/tool.rb, line 49 def to_h hash = { role: role, content: content, tool_call_id: tool_call_id, name: name } #: Hash[Symbol, untyped] hash[:id] = id if id if error? hash[:error] = error hash[:error_type] = error_type end hash end