Class: Vapi::TransferDestinationAssistant
- Inherits:
-
Object
- Object
- Vapi::TransferDestinationAssistant
- Defined in:
- lib/vapi_server_sdk/types/transfer_destination_assistant.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#assistant_name ⇒ String
readonly
This is the assistant to transfer the call to.
-
#description ⇒ String
readonly
This is the description of the destination, used by the AI to choose when and how to transfer the call.
-
#message ⇒ String
readonly
This is the message to say before transferring the call to the destination.
-
#transfer_mode ⇒ Vapi::TransferMode
readonly
This is the mode to use for the transfer.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::TransferDestinationAssistant
Deserialize a JSON object to an instance of TransferDestinationAssistant.
-
.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(assistant_name:, transfer_mode: OMIT, message: OMIT, description: OMIT, additional_properties: nil) ⇒ Vapi::TransferDestinationAssistant constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TransferDestinationAssistant to a JSON object.
Constructor Details
#initialize(assistant_name:, transfer_mode: OMIT, message: OMIT, description: OMIT, additional_properties: nil) ⇒ Vapi::TransferDestinationAssistant
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 125 def initialize(assistant_name:, transfer_mode: OMIT, message: OMIT, description: OMIT, additional_properties: nil) @transfer_mode = transfer_mode if transfer_mode != OMIT @assistant_name = assistant_name @message = if != OMIT @description = description if description != OMIT @additional_properties = additional_properties @_field_set = { "transferMode": transfer_mode, "assistantName": assistant_name, "message": , "description": description }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
65 66 67 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 65 def additional_properties @additional_properties end |
#assistant_name ⇒ String (readonly)
Returns This is the assistant to transfer the call to.
51 52 53 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 51 def assistant_name @assistant_name end |
#description ⇒ String (readonly)
Returns This is the description of the destination, used by the AI to choose when and how to transfer the call.
63 64 65 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 63 def description @description end |
#message ⇒ String (readonly)
Returns This is the message to say before transferring the call to the destination. If this is not provided and transfer tool messages is not provided, default is “Transferring the call now”. If set to “”, nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set ‘assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message` for the destination assistant.
60 61 62 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 60 def @message end |
#transfer_mode ⇒ Vapi::TransferMode (readonly)
Returns This is the mode to use for the transfer. Default is ‘rolling-history`.
-
‘rolling-history`: This is the default mode. It keeps the entire conversation
history and appends the new assistant’s system message on transfer. Example: Pre-transfer: system: assistant1 system message assistant: assistant1 first message user: hey, good morning assistant: how can i help? user: i need help with my account assistant: (destination.message) Post-transfer: system: assistant1 system message assistant: assistant1 first message user: hey, good morning assistant: how can i help? user: i need help with my account assistant: (destination.message) system: assistant2 system message assistant: assistant2 first message (or model generated if firstMessageMode is set to ‘assistant-speaks-first-with-model-generated-message`)
-
‘swap-system-message-in-history`: This replaces the original system message
with the new assistant’s system message on transfer. Example: Pre-transfer: system: assistant1 system message assistant: assistant1 first message user: hey, good morning assistant: how can i help? user: i need help with my account assistant: (destination.message) Post-transfer: system: assistant2 system message assistant: assistant1 first message user: hey, good morning assistant: how can i help? user: i need help with my account assistant: (destination.message) assistant: assistant2 first message (or model generated if firstMessageMode is set to ‘assistant-speaks-first-with-model-generated-message`).
49 50 51 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 49 def transfer_mode @transfer_mode end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::TransferDestinationAssistant
Deserialize a JSON object to an instance of TransferDestinationAssistant
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 145 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) transfer_mode = parsed_json["transferMode"] assistant_name = parsed_json["assistantName"] = parsed_json["message"] description = parsed_json["description"] new( transfer_mode: transfer_mode, assistant_name: assistant_name, message: , description: description, 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.
174 175 176 177 178 179 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 174 def self.validate_raw(obj:) obj.transfer_mode&.is_a?(Vapi::TransferMode) != false || raise("Passed value for field obj.transfer_mode is not the expected type, validation failed.") obj.assistant_name.is_a?(String) != false || raise("Passed value for field obj.assistant_name is not the expected type, validation failed.") obj.&.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.") obj.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TransferDestinationAssistant to a JSON object
164 165 166 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 164 def to_json(*_args) @_field_set&.to_json end |