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 ⇒ Vapi::TransferDestinationAssistantMessage
readonly
This is spoken to the customer before connecting them 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:, message: OMIT, transfer_mode: 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:, message: OMIT, transfer_mode: OMIT, description: OMIT, additional_properties: nil) ⇒ Vapi::TransferDestinationAssistant
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 166 def initialize(assistant_name:, message: OMIT, transfer_mode: OMIT, description: OMIT, additional_properties: nil) @message = if != OMIT @transfer_mode = transfer_mode if transfer_mode != OMIT @assistant_name = assistant_name @description = description if description != OMIT @additional_properties = additional_properties @_field_set = { "message": , "transferMode": transfer_mode, "assistantName": assistant_name, "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.
86 87 88 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 86 def additional_properties @additional_properties end |
#assistant_name ⇒ String (readonly)
Returns This is the assistant to transfer the call to.
81 82 83 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 81 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.
84 85 86 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 84 def description @description end |
#message ⇒ Vapi::TransferDestinationAssistantMessage (readonly)
Returns This is spoken to the customer before connecting them to the destination. Usage:
-
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. This accepts a string or a ToolMessageStart class. Latter is useful if you want to specify multiple messages for different languages through the contents field.
22 23 24 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 22 def @message end |
#transfer_mode ⇒ Vapi::TransferMode (readonly)
Returns This is the mode to use for the transfer. Defaults to 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)
-
delete-history: This deletes the entire conversation history 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: assistant2 first message user: Yes, please assistant: how can i help? user: i need help with my account @default ‘rolling-history’.
79 80 81 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 79 def transfer_mode @transfer_mode end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::TransferDestinationAssistant
Deserialize a JSON object to an instance of TransferDestinationAssistant
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 186 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["message"].nil? = nil else = parsed_json["message"].to_json = Vapi::TransferDestinationAssistantMessage.from_json(json_object: ) end transfer_mode = parsed_json["transferMode"] assistant_name = parsed_json["assistantName"] description = parsed_json["description"] new( message: , transfer_mode: transfer_mode, assistant_name: assistant_name, 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.
220 221 222 223 224 225 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 220 def self.validate_raw(obj:) obj..nil? || Vapi::TransferDestinationAssistantMessage.validate_raw(obj: 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.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
210 211 212 |
# File 'lib/vapi_server_sdk/types/transfer_destination_assistant.rb', line 210 def to_json(*_args) @_field_set&.to_json end |