Class: Vapi::ClientMessageToolCalls
- Inherits:
-
Object
- Object
- Vapi::ClientMessageToolCalls
- Defined in:
- lib/vapi_server_sdk/types/client_message_tool_calls.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#assistant ⇒ Vapi::CreateAssistantDto
readonly
This is the assistant that the message is associated with.
-
#call ⇒ Vapi::Call
readonly
This is the call that the message is associated with.
-
#customer ⇒ Vapi::CreateCustomerDto
readonly
This is the customer that the message is associated with.
-
#phone_number ⇒ Vapi::ClientMessageToolCallsPhoneNumber
readonly
This is the phone number that the message is associated with.
-
#timestamp ⇒ Float
readonly
This is the timestamp of the message.
-
#tool_call_list ⇒ Array<Vapi::ToolCall>
readonly
This is the list of tool calls that the model is requesting.
-
#tool_with_tool_call_list ⇒ Array<Vapi::ClientMessageToolCallsToolWithToolCallListItem>
readonly
This is the list of tools calls that the model is requesting along with the original tool configuration.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ClientMessageToolCalls
Deserialize a JSON object to an instance of ClientMessageToolCalls.
-
.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.
Instance Method Summary collapse
- #initialize(tool_with_tool_call_list:, tool_call_list:, phone_number: OMIT, timestamp: OMIT, call: OMIT, customer: OMIT, assistant: OMIT, additional_properties: nil) ⇒ Vapi::ClientMessageToolCalls constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ClientMessageToolCalls to a JSON object.
Constructor Details
#initialize(tool_with_tool_call_list:, tool_call_list:, phone_number: OMIT, timestamp: OMIT, call: OMIT, customer: OMIT, assistant: OMIT, additional_properties: nil) ⇒ Vapi::ClientMessageToolCalls
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 47 def initialize(tool_with_tool_call_list:, tool_call_list:, phone_number: OMIT, timestamp: OMIT, call: OMIT, customer: OMIT, assistant: OMIT, additional_properties: nil) @phone_number = phone_number if phone_number != OMIT @tool_with_tool_call_list = tool_with_tool_call_list @timestamp = if != OMIT @call = call if call != OMIT @customer = customer if customer != OMIT @assistant = assistant if assistant != OMIT @tool_call_list = tool_call_list @additional_properties = additional_properties @_field_set = { "phoneNumber": phone_number, "toolWithToolCallList": tool_with_tool_call_list, "timestamp": , "call": call, "customer": customer, "assistant": assistant, "toolCallList": tool_call_list }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
30 31 32 |
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 30 def additional_properties @additional_properties end |
#assistant ⇒ Vapi::CreateAssistantDto (readonly)
Returns This is the assistant that the message is associated with.
26 27 28 |
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 26 def assistant @assistant end |
#call ⇒ Vapi::Call (readonly)
Returns This is the call that the message is associated with.
22 23 24 |
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 22 def call @call end |
#customer ⇒ Vapi::CreateCustomerDto (readonly)
Returns This is the customer that the message is associated with.
24 25 26 |
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 24 def customer @customer end |
#phone_number ⇒ Vapi::ClientMessageToolCallsPhoneNumber (readonly)
Returns This is the phone number that the message is associated with.
15 16 17 |
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 15 def phone_number @phone_number end |
#timestamp ⇒ Float (readonly)
Returns This is the timestamp of the message.
20 21 22 |
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 20 def @timestamp end |
#tool_call_list ⇒ Array<Vapi::ToolCall> (readonly)
Returns This is the list of tool calls that the model is requesting.
28 29 30 |
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 28 def tool_call_list @tool_call_list end |
#tool_with_tool_call_list ⇒ Array<Vapi::ClientMessageToolCallsToolWithToolCallListItem> (readonly)
Returns This is the list of tools calls that the model is requesting along with the original tool configuration.
18 19 20 |
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 18 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
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 74 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["phoneNumber"].nil? phone_number = nil else phone_number = parsed_json["phoneNumber"].to_json phone_number = Vapi::ClientMessageToolCallsPhoneNumber.from_json(json_object: phone_number) end tool_with_tool_call_list = parsed_json["toolWithToolCallList"]&.map do |item| item = item.to_json Vapi::ClientMessageToolCallsToolWithToolCallListItem.from_json(json_object: item) end = parsed_json["timestamp"] if parsed_json["call"].nil? call = nil else call = parsed_json["call"].to_json call = Vapi::Call.from_json(json_object: call) end if parsed_json["customer"].nil? customer = nil else customer = parsed_json["customer"].to_json customer = Vapi::CreateCustomerDto.from_json(json_object: customer) end if parsed_json["assistant"].nil? assistant = nil else assistant = parsed_json["assistant"].to_json assistant = Vapi::CreateAssistantDto.from_json(json_object: assistant) end tool_call_list = parsed_json["toolCallList"]&.map do |item| item = item.to_json Vapi::ToolCall.from_json(json_object: item) end new( phone_number: phone_number, tool_with_tool_call_list: tool_with_tool_call_list, timestamp: , call: call, customer: customer, assistant: assistant, 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.
135 136 137 138 139 140 141 142 143 |
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 135 def self.validate_raw(obj:) obj.phone_number.nil? || Vapi::ClientMessageToolCallsPhoneNumber.validate_raw(obj: obj.phone_number) 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.&.is_a?(Float) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.") obj.call.nil? || Vapi::Call.validate_raw(obj: obj.call) obj.customer.nil? || Vapi::CreateCustomerDto.validate_raw(obj: obj.customer) obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant) 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
125 126 127 |
# File 'lib/vapi_server_sdk/types/client_message_tool_calls.rb', line 125 def to_json(*_args) @_field_set&.to_json end |