Class: Vapi::ClientMessageToolCalls

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/client_message_tool_calls.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tool_with_tool_call_list:, tool_call_list:, additional_properties: nil) ⇒ Vapi::ClientMessageToolCalls

Parameters:

  • tool_with_tool_call_list (Array<Vapi::ClientMessageToolCallsToolWithToolCallListItem>)

    This is the list of tools calls that the model is requesting along with the original tool configuration.

  • tool_call_list (Array<Vapi::ToolCall>)

    This is the list of tool calls that the model is requesting.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



28
29
30
31
32
33
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 28

def initialize(tool_with_tool_call_list:, tool_call_list:, additional_properties: nil)
  @tool_with_tool_call_list = tool_with_tool_call_list
  @tool_call_list = tool_call_list
  @additional_properties = additional_properties
  @_field_set = { "toolWithToolCallList": tool_with_tool_call_list, "toolCallList": tool_call_list }
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



16
17
18
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 16

def additional_properties
  @additional_properties
end

#tool_call_listArray<Vapi::ToolCall> (readonly)

Returns This is the list of tool calls that the model is requesting.

Returns:

  • (Array<Vapi::ToolCall>)

    This is the list of tool calls that the model is requesting.



14
15
16
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 14

def tool_call_list
  @tool_call_list
end

#tool_with_tool_call_listArray<Vapi::ClientMessageToolCallsToolWithToolCallListItem> (readonly)

Returns This is the list of tools calls that the model is requesting along with the original tool configuration.

Returns:



12
13
14
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 12

def tool_with_tool_call_list
  @tool_with_tool_call_list
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::ClientMessageToolCalls

Deserialize a JSON object to an instance of ClientMessageToolCalls

Parameters:

  • json_object (String)

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 39

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  tool_with_tool_call_list = parsed_json["toolWithToolCallList"]&.map do |item|
    item = item.to_json
    Vapi::ClientMessageToolCallsToolWithToolCallListItem.from_json(json_object: item)
  end
  tool_call_list = parsed_json["toolCallList"]&.map do |item|
    item = item.to_json
    Vapi::ToolCall.from_json(json_object: item)
  end
  new(
    tool_with_tool_call_list: tool_with_tool_call_list,
    tool_call_list: tool_call_list,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


70
71
72
73
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 70

def self.validate_raw(obj:)
  obj.tool_with_tool_call_list.is_a?(Array) != false || raise("Passed value for field obj.tool_with_tool_call_list is not the expected type, validation failed.")
  obj.tool_call_list.is_a?(Array) != false || raise("Passed value for field obj.tool_call_list is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ClientMessageToolCalls to a JSON object

Returns:

  • (String)


60
61
62
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 60

def to_json(*_args)
  @_field_set&.to_json
end