class Riffer::Messages::Tool
Represents a tool execution result in a conversation.
Attributes
The error message if the tool execution failed.
The type of error (:unknown_tool, :validation_error, :execution_error, :timeout_error).
The name of the tool that was called.
The ID of the tool call this result responds to.
Public Class Methods
Source
# File lib/riffer/messages/tool.rb, line 20 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 32 def error? !@error.nil? end
Returns true if the tool execution resulted in an error.
Source
# File lib/riffer/messages/tool.rb, line 46 def to_h hash = {role: role, content: content, tool_call_id: tool_call_id, name: name} #: Hash[Symbol, untyped] hash[:id] = id unless id.nil? if error? hash[:error] = error hash[:error_type] = error_type end hash end
Converts the message to a hash.