Class: RubyLLM::ToolCall

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/tool_call.rb

Overview

Represents a function call from an AI model to a Tool. Encapsulates the function name, arguments, and execution results in a clean Ruby interface.

Example:

tool_call = ToolCall.new(
  id: "call_123",
  name: "calculator",
  arguments: { expression: "2 + 2" }
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, arguments: {}) ⇒ ToolCall

Returns a new instance of ToolCall.



17
18
19
20
21
# File 'lib/ruby_llm/tool_call.rb', line 17

def initialize(id:, name:, arguments: {})
  @id = id
  @name = name
  @arguments = arguments
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



15
16
17
# File 'lib/ruby_llm/tool_call.rb', line 15

def arguments
  @arguments
end

#idObject (readonly)

Returns the value of attribute id.



15
16
17
# File 'lib/ruby_llm/tool_call.rb', line 15

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



15
16
17
# File 'lib/ruby_llm/tool_call.rb', line 15

def name
  @name
end