Class: Llmshim::ToolCall

Inherits:
Struct
  • Object
show all
Defined in:
lib/llmshim/types.rb

Overview

A single tool call requested by the assistant.

function is a plain Hash with "name" and "arguments" (JSON-encoded string) to match the wire format exactly.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#functionObject

Returns the value of attribute function

Returns:

  • (Object)

    the current value of function



27
28
29
# File 'lib/llmshim/types.rb', line 27

def function
  @function
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



27
28
29
# File 'lib/llmshim/types.rb', line 27

def id
  @id
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



27
28
29
# File 'lib/llmshim/types.rb', line 27

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object



28
29
30
# File 'lib/llmshim/types.rb', line 28

def self.from_hash(hash)
  new(id: hash["id"], type: hash["type"], function: hash["function"])
end

Instance Method Details

#argumentsObject

Convenience accessor for the JSON-encoded arguments string.



38
39
40
# File 'lib/llmshim/types.rb', line 38

def arguments
  function && function["arguments"]
end

#nameObject

Convenience accessor for the tool name.



33
34
35
# File 'lib/llmshim/types.rb', line 33

def name
  function && function["name"]
end