Class: Ragents::ToolCall

Inherits:
Object
  • Object
show all
Defined in:
lib/ragents/provider.rb

Overview

Tool call representation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ToolCall.



128
129
130
131
132
# File 'lib/ragents/provider.rb', line 128

def initialize(id:, name:, arguments:)
  @id = id
  @name = name.to_sym
  @arguments = arguments.is_a?(String) ? JSON.parse(arguments) : arguments
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



126
127
128
# File 'lib/ragents/provider.rb', line 126

def arguments
  @arguments
end

#idObject (readonly)

Returns the value of attribute id.



126
127
128
# File 'lib/ragents/provider.rb', line 126

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



126
127
128
# File 'lib/ragents/provider.rb', line 126

def name
  @name
end

Instance Method Details

#symbolized_argumentsObject



142
143
144
# File 'lib/ragents/provider.rb', line 142

def symbolized_arguments
  @arguments.transform_keys(&:to_sym)
end

#to_hObject



134
135
136
137
138
139
140
# File 'lib/ragents/provider.rb', line 134

def to_h
  {
    id: @id,
    name: @name.to_s,
    arguments: @arguments
  }
end