Class: Mistri::ToolCall

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

Overview

One tool invocation requested by the model. arguments is the parsed Hash exactly as the model emitted it, string keys and all; the top level is owned and frozen, nested values stay as parsed. signature is the opaque reasoning payload some providers attach to the call and require echoed back, such as Gemini's thoughtSignature.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ToolCall.



10
11
12
# File 'lib/mistri/tool_call.rb', line 10

def initialize(id:, name:, arguments: {}, signature: nil)
  super(id:, name:, arguments: arguments.dup.freeze, signature:)
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments

Returns:

  • (Object)

    the current value of arguments



9
10
11
# File 'lib/mistri/tool_call.rb', line 9

def arguments
  @arguments
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



9
10
11
# File 'lib/mistri/tool_call.rb', line 9

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



9
10
11
# File 'lib/mistri/tool_call.rb', line 9

def name
  @name
end

#signatureObject (readonly)

Returns the value of attribute signature

Returns:

  • (Object)

    the current value of signature



9
10
11
# File 'lib/mistri/tool_call.rb', line 9

def signature
  @signature
end

Instance Method Details

#to_hObject



16
# File 'lib/mistri/tool_call.rb', line 16

def to_h = { type: :tool_call, id:, name:, arguments:, signature: }.compact

#typeObject



14
# File 'lib/mistri/tool_call.rb', line 14

def type = :tool_call