Class: OpenRouter::ToolResult

Inherits:
Object
  • Object
show all
Includes:
ToolResultBase
Defined in:
lib/open_router/tool_call.rb

Overview

Represents the result of executing a Chat Completions tool call

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ToolResultBase

#failure?, included, #success?

Constructor Details

#initialize(tool_call, result = nil, error = nil) ⇒ ToolResult

Returns a new instance of ToolResult.



123
124
125
126
127
# File 'lib/open_router/tool_call.rb', line 123

def initialize(tool_call, result = nil, error = nil)
  @tool_call = tool_call
  @result = result
  @error = error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



121
122
123
# File 'lib/open_router/tool_call.rb', line 121

def error
  @error
end

#resultObject (readonly)

Returns the value of attribute result.



121
122
123
# File 'lib/open_router/tool_call.rb', line 121

def result
  @result
end

#tool_callObject (readonly)

Returns the value of attribute tool_call.



121
122
123
# File 'lib/open_router/tool_call.rb', line 121

def tool_call
  @tool_call
end

Instance Method Details

#to_messageObject

Convert to message format for conversation continuation



130
131
132
# File 'lib/open_router/tool_call.rb', line 130

def to_message
  @tool_call.to_result_message(@error || @result)
end