vapi_server_sdk 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/lib/requests.rb +2 -2
  3. data/lib/types_export.rb +60 -14
  4. data/lib/vapi_server_sdk/analytics/client.rb +41 -12
  5. data/lib/vapi_server_sdk/assistants/client.rb +80 -14
  6. data/lib/vapi_server_sdk/assistants/types/update_assistant_dto_server_messages_item.rb +1 -0
  7. data/lib/vapi_server_sdk/calls/client.rb +104 -6
  8. data/lib/vapi_server_sdk/logs/client.rb +2 -2
  9. data/lib/vapi_server_sdk/squads/client.rb +128 -8
  10. data/lib/vapi_server_sdk/test_suite_runs/client.rb +328 -0
  11. data/lib/vapi_server_sdk/test_suite_runs/types/test_suite_run_controller_find_all_paginated_request_sort_order.rb +10 -0
  12. data/lib/vapi_server_sdk/test_suite_tests/client.rb +331 -0
  13. data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_create_request.rb +81 -0
  14. data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_find_all_paginated_request_sort_order.rb +10 -0
  15. data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_remove_response.rb +82 -0
  16. data/lib/vapi_server_sdk/test_suite_tests/types/test_suite_test_controller_update_request.rb +81 -0
  17. data/lib/vapi_server_sdk/test_suites/client.rb +338 -0
  18. data/lib/vapi_server_sdk/test_suites/types/test_suite_controller_find_all_paginated_request_sort_order.rb +10 -0
  19. data/lib/vapi_server_sdk/types/{semantic_edge_condition.rb → ai_edge_condition.rb} +9 -11
  20. data/lib/vapi_server_sdk/types/analytics_operation_column.rb +1 -0
  21. data/lib/vapi_server_sdk/types/analytics_operation_operation.rb +1 -0
  22. data/lib/vapi_server_sdk/types/analytics_query.rb +4 -3
  23. data/lib/vapi_server_sdk/types/analytics_query_table.rb +9 -0
  24. data/lib/vapi_server_sdk/types/api_request.rb +165 -0
  25. data/lib/vapi_server_sdk/types/api_request_method.rb +8 -0
  26. data/lib/vapi_server_sdk/types/api_request_mode.rb +10 -0
  27. data/lib/vapi_server_sdk/types/artifact.rb +12 -2
  28. data/lib/vapi_server_sdk/types/artifact_plan.rb +56 -8
  29. data/lib/vapi_server_sdk/types/assistant.rb +27 -13
  30. data/lib/vapi_server_sdk/types/assistant_hook_action_base.rb +47 -0
  31. data/lib/vapi_server_sdk/types/assistant_hook_filter.rb +72 -0
  32. data/lib/vapi_server_sdk/types/assistant_hooks.rb +82 -0
  33. data/lib/vapi_server_sdk/types/assistant_overrides.rb +28 -14
  34. data/lib/vapi_server_sdk/types/assistant_overrides_server_messages_item.rb +1 -0
  35. data/lib/vapi_server_sdk/types/assistant_server_messages_item.rb +1 -0
  36. data/lib/vapi_server_sdk/types/azure_open_ai_credential_models_item.rb +1 -0
  37. data/lib/vapi_server_sdk/types/backoff_plan.rb +80 -0
  38. data/lib/vapi_server_sdk/types/byo_phone_number.rb +10 -1
  39. data/lib/vapi_server_sdk/types/byo_phone_number_status.rb +10 -0
  40. data/lib/vapi_server_sdk/types/call_ended_reason.rb +10 -1
  41. data/lib/vapi_server_sdk/types/cartesia_experimental_controls.rb +69 -0
  42. data/lib/vapi_server_sdk/types/cartesia_experimental_controls_emotion.rb +26 -0
  43. data/lib/vapi_server_sdk/types/cartesia_experimental_controls_speed.rb +11 -0
  44. data/lib/vapi_server_sdk/types/cartesia_voice.rb +24 -10
  45. data/lib/vapi_server_sdk/types/chat_completion_message.rb +80 -0
  46. data/lib/vapi_server_sdk/types/chat_completion_message_metadata.rb +94 -0
  47. data/lib/vapi_server_sdk/types/chat_completions_dto.rb +84 -0
  48. data/lib/vapi_server_sdk/types/client_inbound_message_transfer.rb +13 -3
  49. data/lib/vapi_server_sdk/types/client_message_conversation_update.rb +15 -2
  50. data/lib/vapi_server_sdk/types/client_message_hang.rb +22 -4
  51. data/lib/vapi_server_sdk/types/client_message_language_change_detected.rb +15 -3
  52. data/lib/vapi_server_sdk/types/client_message_message.rb +165 -181
  53. data/lib/vapi_server_sdk/types/client_message_metadata.rb +15 -3
  54. data/lib/vapi_server_sdk/types/client_message_model_output.rb +15 -3
  55. data/lib/vapi_server_sdk/types/client_message_speech_update.rb +11 -2
  56. data/lib/vapi_server_sdk/types/client_message_tool_calls.rb +15 -2
  57. data/lib/vapi_server_sdk/types/client_message_tool_calls_result.rb +15 -3
  58. data/lib/vapi_server_sdk/types/client_message_transcript.rb +12 -2
  59. data/lib/vapi_server_sdk/types/client_message_transcript_type.rb +10 -0
  60. data/lib/vapi_server_sdk/types/client_message_transfer_update.rb +11 -1
  61. data/lib/vapi_server_sdk/types/client_message_user_interrupted.rb +14 -4
  62. data/lib/vapi_server_sdk/types/client_message_voice_input.rb +15 -3
  63. data/lib/vapi_server_sdk/types/client_message_workflow_node_started.rb +67 -0
  64. data/lib/vapi_server_sdk/types/compliance_plan.rb +77 -0
  65. data/lib/vapi_server_sdk/types/create_assistant_dto.rb +28 -14
  66. data/lib/vapi_server_sdk/types/create_assistant_dto_server_messages_item.rb +1 -0
  67. data/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_models_item.rb +1 -0
  68. data/lib/vapi_server_sdk/types/create_test_suite_test_voice_dto.rb +90 -0
  69. data/lib/vapi_server_sdk/types/create_vapi_phone_number_dto.rb +12 -4
  70. data/lib/vapi_server_sdk/types/create_workflow_dto.rb +2 -9
  71. data/lib/vapi_server_sdk/types/create_workflow_dto_nodes_item.rb +104 -52
  72. data/lib/vapi_server_sdk/types/deep_seek_model.rb +4 -3
  73. data/lib/vapi_server_sdk/types/deep_seek_model_model.rb +9 -0
  74. data/lib/vapi_server_sdk/types/deepgram_transcriber.rb +28 -2
  75. data/lib/vapi_server_sdk/types/deepgram_voice.rb +22 -2
  76. data/lib/vapi_server_sdk/types/edge.rb +9 -2
  77. data/lib/vapi_server_sdk/types/edge_condition.rb +32 -19
  78. data/lib/vapi_server_sdk/types/failed_edge_condition.rb +47 -0
  79. data/lib/vapi_server_sdk/types/fallback_cartesia_voice.rb +24 -9
  80. data/lib/vapi_server_sdk/types/fallback_deepgram_voice.rb +17 -2
  81. data/lib/vapi_server_sdk/types/fallback_play_ht_voice_model.rb +1 -0
  82. data/lib/vapi_server_sdk/types/fallback_rime_ai_voice_id_enum.rb +22 -20
  83. data/lib/vapi_server_sdk/types/fallback_rime_ai_voice_model.rb +1 -0
  84. data/lib/vapi_server_sdk/types/format_plan.rb +22 -2
  85. data/lib/vapi_server_sdk/types/format_plan_formatters_enabled_item.rb +22 -0
  86. data/lib/vapi_server_sdk/types/gather.rb +81 -25
  87. data/lib/vapi_server_sdk/types/google_model_model.rb +4 -0
  88. data/lib/vapi_server_sdk/types/groq_model_model.rb +1 -0
  89. data/lib/vapi_server_sdk/types/hangup.rb +67 -0
  90. data/lib/vapi_server_sdk/types/hook.rb +70 -0
  91. data/lib/vapi_server_sdk/types/hook_on.rb +9 -0
  92. data/lib/vapi_server_sdk/types/invite_user_dto.rb +11 -2
  93. data/lib/vapi_server_sdk/types/json_schema.rb +26 -2
  94. data/lib/vapi_server_sdk/types/{programmatic_edge_condition.rb → logic_edge_condition.rb} +13 -15
  95. data/lib/vapi_server_sdk/types/message_plan.rb +12 -2
  96. data/lib/vapi_server_sdk/types/open_ai_model.rb +1 -9
  97. data/lib/vapi_server_sdk/types/open_ai_model_fallback_models_item.rb +2 -0
  98. data/lib/vapi_server_sdk/types/open_ai_model_model.rb +2 -0
  99. data/lib/vapi_server_sdk/types/play_ht_voice_model.rb +1 -0
  100. data/lib/vapi_server_sdk/types/rime_ai_voice_id_enum.rb +22 -20
  101. data/lib/vapi_server_sdk/types/rime_ai_voice_model.rb +1 -0
  102. data/lib/vapi_server_sdk/types/say.rb +23 -14
  103. data/lib/vapi_server_sdk/types/say_hook.rb +81 -0
  104. data/lib/vapi_server_sdk/types/server.rb +17 -2
  105. data/lib/vapi_server_sdk/types/server_message_assistant_request.rb +12 -2
  106. data/lib/vapi_server_sdk/types/server_message_conversation_update.rb +12 -2
  107. data/lib/vapi_server_sdk/types/server_message_end_of_call_report.rb +11 -1
  108. data/lib/vapi_server_sdk/types/server_message_end_of_call_report_ended_reason.rb +10 -1
  109. data/lib/vapi_server_sdk/types/server_message_hang.rb +20 -2
  110. data/lib/vapi_server_sdk/types/server_message_knowledge_base_request.rb +14 -2
  111. data/lib/vapi_server_sdk/types/server_message_language_change_detected.rb +11 -1
  112. data/lib/vapi_server_sdk/types/server_message_message.rb +212 -237
  113. data/lib/vapi_server_sdk/types/server_message_model_output.rb +11 -1
  114. data/lib/vapi_server_sdk/types/server_message_phone_call_control.rb +18 -2
  115. data/lib/vapi_server_sdk/types/server_message_speech_update.rb +11 -1
  116. data/lib/vapi_server_sdk/types/server_message_status_update.rb +12 -2
  117. data/lib/vapi_server_sdk/types/server_message_status_update_ended_reason.rb +10 -1
  118. data/lib/vapi_server_sdk/types/server_message_tool_calls.rb +10 -2
  119. data/lib/vapi_server_sdk/types/server_message_transcript.rb +13 -2
  120. data/lib/vapi_server_sdk/types/server_message_transcript_type.rb +10 -0
  121. data/lib/vapi_server_sdk/types/server_message_transfer_destination_request.rb +12 -2
  122. data/lib/vapi_server_sdk/types/server_message_transfer_update.rb +11 -1
  123. data/lib/vapi_server_sdk/types/server_message_user_interrupted.rb +12 -2
  124. data/lib/vapi_server_sdk/types/server_message_voice_input.rb +11 -1
  125. data/lib/vapi_server_sdk/types/server_message_voice_request.rb +50 -2
  126. data/lib/vapi_server_sdk/types/stop_speaking_plan.rb +27 -2
  127. data/lib/vapi_server_sdk/types/subscription.rb +33 -5
  128. data/lib/vapi_server_sdk/types/sync_voice_library_dto_providers_item.rb +1 -0
  129. data/lib/vapi_server_sdk/types/test_suite.rb +104 -0
  130. data/lib/vapi_server_sdk/types/test_suite_run.rb +127 -0
  131. data/lib/vapi_server_sdk/types/test_suite_run_scorer_ai.rb +80 -0
  132. data/lib/vapi_server_sdk/types/test_suite_run_scorer_ai_result.rb +9 -0
  133. data/lib/vapi_server_sdk/types/test_suite_run_status.rb +10 -0
  134. data/lib/vapi_server_sdk/types/test_suite_run_test_attempt.rb +75 -0
  135. data/lib/vapi_server_sdk/types/{analytics_query_dto.rb → test_suite_run_test_attempt_call.rb} +19 -17
  136. data/lib/vapi_server_sdk/types/test_suite_run_test_result.rb +75 -0
  137. data/lib/vapi_server_sdk/types/test_suite_runs_paginated_response.rb +75 -0
  138. data/lib/vapi_server_sdk/types/test_suite_test_scorer_ai.rb +65 -0
  139. data/lib/vapi_server_sdk/types/test_suite_test_voice.rb +132 -0
  140. data/lib/vapi_server_sdk/types/test_suite_tests_paginated_response.rb +75 -0
  141. data/lib/vapi_server_sdk/types/test_suites_paginated_response.rb +75 -0
  142. data/lib/vapi_server_sdk/types/time_range_step.rb +1 -0
  143. data/lib/vapi_server_sdk/types/tool_message_start.rb +18 -2
  144. data/lib/vapi_server_sdk/types/transfer.rb +74 -0
  145. data/lib/vapi_server_sdk/types/transfer_assistant_hook_action.rb +75 -0
  146. data/lib/vapi_server_sdk/types/{buy_phone_number_dto_fallback_destination.rb → transfer_assistant_hook_action_destination.rb} +9 -12
  147. data/lib/vapi_server_sdk/types/transfer_destination_assistant.rb +46 -0
  148. data/lib/vapi_server_sdk/types/transfer_plan.rb +37 -1
  149. data/lib/vapi_server_sdk/types/transfer_plan_mode.rb +4 -0
  150. data/lib/vapi_server_sdk/types/trieve_knowledge_base_search_plan.rb +12 -1
  151. data/lib/vapi_server_sdk/types/twilio_phone_number.rb +11 -2
  152. data/lib/vapi_server_sdk/types/twilio_phone_number_status.rb +10 -0
  153. data/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_models_item.rb +1 -0
  154. data/lib/vapi_server_sdk/types/update_test_suite_test_voice_dto.rb +90 -0
  155. data/lib/vapi_server_sdk/types/vapi_phone_number.rb +29 -4
  156. data/lib/vapi_server_sdk/types/vapi_phone_number_status.rb +10 -0
  157. data/lib/vapi_server_sdk/types/vonage_phone_number.rb +11 -2
  158. data/lib/vapi_server_sdk/types/vonage_phone_number_status.rb +10 -0
  159. data/lib/vapi_server_sdk/types/workflow.rb +1 -9
  160. data/lib/vapi_server_sdk/types/workflow_nodes_item.rb +104 -52
  161. data/lib/vapi_server_sdk/types/xai_model.rb +4 -3
  162. data/lib/vapi_server_sdk/types/xai_model_model.rb +10 -0
  163. data/lib/vapi_server_sdk.rb +21 -0
  164. metadata +61 -12
  165. data/lib/vapi_server_sdk/types/buy_phone_number_dto.rb +0 -147
  166. data/lib/vapi_server_sdk/types/org_with_org_user.rb +0 -262
  167. data/lib/vapi_server_sdk/types/org_with_org_user_channel.rb +0 -10
  168. data/lib/vapi_server_sdk/types/org_with_org_user_role.rb +0 -9
  169. data/lib/vapi_server_sdk/types/update_workflow_dto.rb +0 -82
  170. data/lib/vapi_server_sdk/types/update_workflow_dto_nodes_item.rb +0 -81
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vapi
7
+ class Transfer
8
+ # @return [Hash{String => Object}]
9
+ attr_reader :destination
10
+ # @return [String]
11
+ attr_reader :name
12
+ # @return [Hash{String => Object}] This is for metadata you want to store on the task.
13
+ attr_reader :metadata
14
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
15
+ attr_reader :additional_properties
16
+ # @return [Object]
17
+ attr_reader :_field_set
18
+ protected :_field_set
19
+
20
+ OMIT = Object.new
21
+
22
+ # @param destination [Hash{String => Object}]
23
+ # @param name [String]
24
+ # @param metadata [Hash{String => Object}] This is for metadata you want to store on the task.
25
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
+ # @return [Vapi::Transfer]
27
+ def initialize(destination:, name:, metadata: OMIT, additional_properties: nil)
28
+ @destination = destination
29
+ @name = name
30
+ @metadata = metadata if metadata != OMIT
31
+ @additional_properties = additional_properties
32
+ @_field_set = { "destination": destination, "name": name, "metadata": metadata }.reject do |_k, v|
33
+ v == OMIT
34
+ end
35
+ end
36
+
37
+ # Deserialize a JSON object to an instance of Transfer
38
+ #
39
+ # @param json_object [String]
40
+ # @return [Vapi::Transfer]
41
+ def self.from_json(json_object:)
42
+ struct = JSON.parse(json_object, object_class: OpenStruct)
43
+ parsed_json = JSON.parse(json_object)
44
+ destination = parsed_json["destination"]
45
+ name = parsed_json["name"]
46
+ metadata = parsed_json["metadata"]
47
+ new(
48
+ destination: destination,
49
+ name: name,
50
+ metadata: metadata,
51
+ additional_properties: struct
52
+ )
53
+ end
54
+
55
+ # Serialize an instance of Transfer to a JSON object
56
+ #
57
+ # @return [String]
58
+ def to_json(*_args)
59
+ @_field_set&.to_json
60
+ end
61
+
62
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
63
+ # hash and check each fields type against the current object's property
64
+ # definitions.
65
+ #
66
+ # @param obj [Object]
67
+ # @return [Void]
68
+ def self.validate_raw(obj:)
69
+ obj.destination.is_a?(Hash) != false || raise("Passed value for field obj.destination is not the expected type, validation failed.")
70
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
71
+ obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "transfer_assistant_hook_action_destination"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module Vapi
8
+ class TransferAssistantHookAction
9
+ # @return [String] This is the type of action - must be "transfer"
10
+ attr_reader :type
11
+ # @return [Vapi::TransferAssistantHookActionDestination] This is the destination details for the transfer - can be a phone number or SIP
12
+ # URI
13
+ attr_reader :destination
14
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
15
+ attr_reader :additional_properties
16
+ # @return [Object]
17
+ attr_reader :_field_set
18
+ protected :_field_set
19
+
20
+ OMIT = Object.new
21
+
22
+ # @param type [String] This is the type of action - must be "transfer"
23
+ # @param destination [Vapi::TransferAssistantHookActionDestination] This is the destination details for the transfer - can be a phone number or SIP
24
+ # URI
25
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
+ # @return [Vapi::TransferAssistantHookAction]
27
+ def initialize(type:, destination: OMIT, additional_properties: nil)
28
+ @type = type
29
+ @destination = destination if destination != OMIT
30
+ @additional_properties = additional_properties
31
+ @_field_set = { "type": type, "destination": destination }.reject do |_k, v|
32
+ v == OMIT
33
+ end
34
+ end
35
+
36
+ # Deserialize a JSON object to an instance of TransferAssistantHookAction
37
+ #
38
+ # @param json_object [String]
39
+ # @return [Vapi::TransferAssistantHookAction]
40
+ def self.from_json(json_object:)
41
+ struct = JSON.parse(json_object, object_class: OpenStruct)
42
+ parsed_json = JSON.parse(json_object)
43
+ type = parsed_json["type"]
44
+ if parsed_json["destination"].nil?
45
+ destination = nil
46
+ else
47
+ destination = parsed_json["destination"].to_json
48
+ destination = Vapi::TransferAssistantHookActionDestination.from_json(json_object: destination)
49
+ end
50
+ new(
51
+ type: type,
52
+ destination: destination,
53
+ additional_properties: struct
54
+ )
55
+ end
56
+
57
+ # Serialize an instance of TransferAssistantHookAction to a JSON object
58
+ #
59
+ # @return [String]
60
+ def to_json(*_args)
61
+ @_field_set&.to_json
62
+ end
63
+
64
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
65
+ # hash and check each fields type against the current object's property
66
+ # definitions.
67
+ #
68
+ # @param obj [Object]
69
+ # @return [Void]
70
+ def self.validate_raw(obj:)
71
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
72
+ obj.destination.nil? || Vapi::TransferAssistantHookActionDestination.validate_raw(obj: obj.destination)
73
+ end
74
+ end
75
+ end
@@ -5,13 +5,9 @@ require_relative "transfer_destination_number"
5
5
  require_relative "transfer_destination_sip"
6
6
 
7
7
  module Vapi
8
- # This is the fallback destination an inbound call will be transferred to if:
9
- # 1. `assistantId` is not set
10
- # 2. `squadId` is not set
11
- # 3. and, `assistant-request` message to the `serverUrl` fails
12
- # If this is not set and above conditions are met, the inbound call is hung up
13
- # with an error message.
14
- class BuyPhoneNumberDtoFallbackDestination
8
+ # This is the destination details for the transfer - can be a phone number or SIP
9
+ # URI
10
+ class TransferAssistantHookActionDestination
15
11
  # @return [Object]
16
12
  attr_reader :member
17
13
  # @return [String]
@@ -22,16 +18,17 @@ module Vapi
22
18
 
23
19
  # @param member [Object]
24
20
  # @param discriminant [String]
25
- # @return [Vapi::BuyPhoneNumberDtoFallbackDestination]
21
+ # @return [Vapi::TransferAssistantHookActionDestination]
26
22
  def initialize(member:, discriminant:)
27
23
  @member = member
28
24
  @discriminant = discriminant
29
25
  end
30
26
 
31
- # Deserialize a JSON object to an instance of BuyPhoneNumberDtoFallbackDestination
27
+ # Deserialize a JSON object to an instance of
28
+ # TransferAssistantHookActionDestination
32
29
  #
33
30
  # @param json_object [String]
34
- # @return [Vapi::BuyPhoneNumberDtoFallbackDestination]
31
+ # @return [Vapi::TransferAssistantHookActionDestination]
35
32
  def self.from_json(json_object:)
36
33
  struct = JSON.parse(json_object, object_class: OpenStruct)
37
34
  member = case struct.type
@@ -86,13 +83,13 @@ module Vapi
86
83
  end
87
84
 
88
85
  # @param member [Vapi::TransferDestinationNumber]
89
- # @return [Vapi::BuyPhoneNumberDtoFallbackDestination]
86
+ # @return [Vapi::TransferAssistantHookActionDestination]
90
87
  def self.number(member:)
91
88
  new(member: member, discriminant: "number")
92
89
  end
93
90
 
94
91
  # @param member [Vapi::TransferDestinationSip]
95
- # @return [Vapi::BuyPhoneNumberDtoFallbackDestination]
92
+ # @return [Vapi::TransferAssistantHookActionDestination]
96
93
  def self.sip(member:)
97
94
  new(member: member, discriminant: "sip")
98
95
  end
@@ -75,6 +75,29 @@ module Vapi
75
75
  # user: Yes, please
76
76
  # assistant: how can i help?
77
77
  # user: i need help with my account
78
+ # - `swap-system-message-in-history-and-remove-transfer-tool-messages`: This
79
+ # replaces the original system message with the new assistant's system message on
80
+ # transfer and removes transfer tool messages from conversation history sent to
81
+ # the LLM.
82
+ # Example:
83
+ # Pre-transfer:
84
+ # system: assistant1 system message
85
+ # assistant: assistant1 first message
86
+ # user: hey, good morning
87
+ # assistant: how can i help?
88
+ # user: i need help with my account
89
+ # transfer-tool
90
+ # transfer-tool-result
91
+ # assistant: (destination.message)
92
+ # Post-transfer:
93
+ # system: assistant2 system message
94
+ # assistant: assistant1 first message
95
+ # user: hey, good morning
96
+ # assistant: how can i help?
97
+ # user: i need help with my account
98
+ # assistant: (destination.message)
99
+ # assistant: assistant2 first message (or model generated if firstMessageMode
100
+ # is set to `assistant-speaks-first-with-model-generated-message`)
78
101
  # @default 'rolling-history'
79
102
  attr_reader :transfer_mode
80
103
  # @return [String] This is the assistant to transfer the call to.
@@ -157,6 +180,29 @@ module Vapi
157
180
  # user: Yes, please
158
181
  # assistant: how can i help?
159
182
  # user: i need help with my account
183
+ # - `swap-system-message-in-history-and-remove-transfer-tool-messages`: This
184
+ # replaces the original system message with the new assistant's system message on
185
+ # transfer and removes transfer tool messages from conversation history sent to
186
+ # the LLM.
187
+ # Example:
188
+ # Pre-transfer:
189
+ # system: assistant1 system message
190
+ # assistant: assistant1 first message
191
+ # user: hey, good morning
192
+ # assistant: how can i help?
193
+ # user: i need help with my account
194
+ # transfer-tool
195
+ # transfer-tool-result
196
+ # assistant: (destination.message)
197
+ # Post-transfer:
198
+ # system: assistant2 system message
199
+ # assistant: assistant1 first message
200
+ # user: hey, good morning
201
+ # assistant: how can i help?
202
+ # user: i need help with my account
203
+ # assistant: (destination.message)
204
+ # assistant: assistant2 first message (or model generated if firstMessageMode
205
+ # is set to `assistant-speaks-first-with-model-generated-message`)
160
206
  # @default 'rolling-history'
161
207
  # @param assistant_name [String] This is the assistant to transfer the call to.
162
208
  # @param description [String] This is the description of the destination, used by the AI to choose when and
@@ -27,6 +27,9 @@ module Vapi
27
27
  # - `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`: The
28
28
  # assistant dials the destination, waits for the operator to speak, provides a
29
29
  # summary of the call to the destination party, and then connects the customer.
30
+ # - `warm-transfer-twiml`: The assistant dials the destination, executes the twiml
31
+ # instructions on the destination call leg, connects the customer, and leaves the
32
+ # call.
30
33
  # @default 'blind-transfer'
31
34
  attr_reader :mode
32
35
  # @return [Vapi::TransferPlanMessage] This is the message the assistant will deliver to the destination party before
@@ -40,6 +43,19 @@ module Vapi
40
43
  # - 'refer': Uses SIP REFER to transfer the call (default)
41
44
  # - 'bye': Ends current call with SIP BYE
42
45
  attr_reader :sip_verb
46
+ # @return [String] This is the TwiML instructions to execute on the destination call leg before
47
+ # connecting the customer.
48
+ # Usage:
49
+ # - Used only when `mode` is `warm-transfer-twiml`.
50
+ # - Supports only `Play`, `Say`, `Gather`, `Hangup` and `Pause` verbs.
51
+ # - Maximum length is 4096 characters.
52
+ # Example:
53
+ # ```
54
+ # <Say voice="alice" language="en-US">Hello, transferring a customer to you.</Say>
55
+ # <Pause length="2"/>
56
+ # <Say>They called about billing questions.</Say>
57
+ # ```
58
+ attr_reader :twiml
43
59
  # @return [Vapi::SummaryPlan] This is the plan for generating a summary of the call to present to the
44
60
  # destination party.
45
61
  # Usage:
@@ -74,6 +90,9 @@ module Vapi
74
90
  # - `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`: The
75
91
  # assistant dials the destination, waits for the operator to speak, provides a
76
92
  # summary of the call to the destination party, and then connects the customer.
93
+ # - `warm-transfer-twiml`: The assistant dials the destination, executes the twiml
94
+ # instructions on the destination call leg, connects the customer, and leaves the
95
+ # call.
77
96
  # @default 'blind-transfer'
78
97
  # @param message [Vapi::TransferPlanMessage] This is the message the assistant will deliver to the destination party before
79
98
  # connecting the customer.
@@ -84,6 +103,18 @@ module Vapi
84
103
  # @param sip_verb [Hash{String => Object}] This specifies the SIP verb to use while transferring the call.
85
104
  # - 'refer': Uses SIP REFER to transfer the call (default)
86
105
  # - 'bye': Ends current call with SIP BYE
106
+ # @param twiml [String] This is the TwiML instructions to execute on the destination call leg before
107
+ # connecting the customer.
108
+ # Usage:
109
+ # - Used only when `mode` is `warm-transfer-twiml`.
110
+ # - Supports only `Play`, `Say`, `Gather`, `Hangup` and `Pause` verbs.
111
+ # - Maximum length is 4096 characters.
112
+ # Example:
113
+ # ```
114
+ # <Say voice="alice" language="en-US">Hello, transferring a customer to you.</Say>
115
+ # <Pause length="2"/>
116
+ # <Say>They called about billing questions.</Say>
117
+ # ```
87
118
  # @param summary_plan [Vapi::SummaryPlan] This is the plan for generating a summary of the call to present to the
88
119
  # destination party.
89
120
  # Usage:
@@ -92,16 +123,18 @@ module Vapi
92
123
  # `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`.
93
124
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
94
125
  # @return [Vapi::TransferPlan]
95
- def initialize(mode:, message: OMIT, sip_verb: OMIT, summary_plan: OMIT, additional_properties: nil)
126
+ def initialize(mode:, message: OMIT, sip_verb: OMIT, twiml: OMIT, summary_plan: OMIT, additional_properties: nil)
96
127
  @mode = mode
97
128
  @message = message if message != OMIT
98
129
  @sip_verb = sip_verb if sip_verb != OMIT
130
+ @twiml = twiml if twiml != OMIT
99
131
  @summary_plan = summary_plan if summary_plan != OMIT
100
132
  @additional_properties = additional_properties
101
133
  @_field_set = {
102
134
  "mode": mode,
103
135
  "message": message,
104
136
  "sipVerb": sip_verb,
137
+ "twiml": twiml,
105
138
  "summaryPlan": summary_plan
106
139
  }.reject do |_k, v|
107
140
  v == OMIT
@@ -123,6 +156,7 @@ module Vapi
123
156
  message = Vapi::TransferPlanMessage.from_json(json_object: message)
124
157
  end
125
158
  sip_verb = parsed_json["sipVerb"]
159
+ twiml = parsed_json["twiml"]
126
160
  if parsed_json["summaryPlan"].nil?
127
161
  summary_plan = nil
128
162
  else
@@ -133,6 +167,7 @@ module Vapi
133
167
  mode: mode,
134
168
  message: message,
135
169
  sip_verb: sip_verb,
170
+ twiml: twiml,
136
171
  summary_plan: summary_plan,
137
172
  additional_properties: struct
138
173
  )
@@ -155,6 +190,7 @@ module Vapi
155
190
  obj.mode.is_a?(Vapi::TransferPlanMode) != false || raise("Passed value for field obj.mode is not the expected type, validation failed.")
156
191
  obj.message.nil? || Vapi::TransferPlanMessage.validate_raw(obj: obj.message)
157
192
  obj.sip_verb&.is_a?(Hash) != false || raise("Passed value for field obj.sip_verb is not the expected type, validation failed.")
193
+ obj.twiml&.is_a?(String) != false || raise("Passed value for field obj.twiml is not the expected type, validation failed.")
158
194
  obj.summary_plan.nil? || Vapi::SummaryPlan.validate_raw(obj: obj.summary_plan)
159
195
  end
160
196
  end
@@ -20,12 +20,16 @@ module Vapi
20
20
  # - `warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary`: The
21
21
  # assistant dials the destination, waits for the operator to speak, provides a
22
22
  # summary of the call to the destination party, and then connects the customer.
23
+ # - `warm-transfer-twiml`: The assistant dials the destination, executes the twiml
24
+ # instructions on the destination call leg, connects the customer, and leaves the
25
+ # call.
23
26
  # @default 'blind-transfer'
24
27
  class TransferPlanMode
25
28
  BLIND_TRANSFER = "blind-transfer"
26
29
  BLIND_TRANSFER_ADD_SUMMARY_TO_SIP_HEADER = "blind-transfer-add-summary-to-sip-header"
27
30
  WARM_TRANSFER_SAY_MESSAGE = "warm-transfer-say-message"
28
31
  WARM_TRANSFER_SAY_SUMMARY = "warm-transfer-say-summary"
32
+ WARM_TRANSFER_TWIML = "warm-transfer-twiml"
29
33
  WARM_TRANSFER_WAIT_FOR_OPERATOR_TO_SPEAK_FIRST_AND_THEN_SAY_MESSAGE = "warm-transfer-wait-for-operator-to-speak-first-and-then-say-message"
30
34
  WARM_TRANSFER_WAIT_FOR_OPERATOR_TO_SPEAK_FIRST_AND_THEN_SAY_SUMMARY = "warm-transfer-wait-for-operator-to-speak-first-and-then-say-summary"
31
35
  end
@@ -6,6 +6,9 @@ require "json"
6
6
 
7
7
  module Vapi
8
8
  class TrieveKnowledgeBaseSearchPlan
9
+ # @return [Float] Specifies the number of top chunks to return. This corresponds to the
10
+ # `page_size` parameter in Trieve.
11
+ attr_reader :top_k
9
12
  # @return [Boolean] If true, stop words (specified in server/src/stop-words.txt in the git repo)
10
13
  # will be removed. This will preserve queries that are entirely stop words.
11
14
  attr_reader :remove_stop_words
@@ -27,6 +30,8 @@ module Vapi
27
30
 
28
31
  OMIT = Object.new
29
32
 
33
+ # @param top_k [Float] Specifies the number of top chunks to return. This corresponds to the
34
+ # `page_size` parameter in Trieve.
30
35
  # @param remove_stop_words [Boolean] If true, stop words (specified in server/src/stop-words.txt in the git repo)
31
36
  # will be removed. This will preserve queries that are entirely stop words.
32
37
  # @param score_threshold [Float] This is the score threshold to filter out chunks with a score below the
@@ -39,12 +44,15 @@ module Vapi
39
44
  # vector store.
40
45
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
41
46
  # @return [Vapi::TrieveKnowledgeBaseSearchPlan]
42
- def initialize(search_type:, remove_stop_words: OMIT, score_threshold: OMIT, additional_properties: nil)
47
+ def initialize(search_type:, top_k: OMIT, remove_stop_words: OMIT, score_threshold: OMIT,
48
+ additional_properties: nil)
49
+ @top_k = top_k if top_k != OMIT
43
50
  @remove_stop_words = remove_stop_words if remove_stop_words != OMIT
44
51
  @score_threshold = score_threshold if score_threshold != OMIT
45
52
  @search_type = search_type
46
53
  @additional_properties = additional_properties
47
54
  @_field_set = {
55
+ "topK": top_k,
48
56
  "removeStopWords": remove_stop_words,
49
57
  "scoreThreshold": score_threshold,
50
58
  "searchType": search_type
@@ -60,10 +68,12 @@ module Vapi
60
68
  def self.from_json(json_object:)
61
69
  struct = JSON.parse(json_object, object_class: OpenStruct)
62
70
  parsed_json = JSON.parse(json_object)
71
+ top_k = parsed_json["topK"]
63
72
  remove_stop_words = parsed_json["removeStopWords"]
64
73
  score_threshold = parsed_json["scoreThreshold"]
65
74
  search_type = parsed_json["searchType"]
66
75
  new(
76
+ top_k: top_k,
67
77
  remove_stop_words: remove_stop_words,
68
78
  score_threshold: score_threshold,
69
79
  search_type: search_type,
@@ -85,6 +95,7 @@ module Vapi
85
95
  # @param obj [Object]
86
96
  # @return [Void]
87
97
  def self.validate_raw(obj:)
98
+ obj.top_k&.is_a?(Float) != false || raise("Passed value for field obj.top_k is not the expected type, validation failed.")
88
99
  obj.remove_stop_words&.is_a?(Boolean) != false || raise("Passed value for field obj.remove_stop_words is not the expected type, validation failed.")
89
100
  obj.score_threshold&.is_a?(Float) != false || raise("Passed value for field obj.score_threshold is not the expected type, validation failed.")
90
101
  obj.search_type.is_a?(Vapi::TrieveKnowledgeBaseSearchPlanSearchType) != false || raise("Passed value for field obj.search_type is not the expected type, validation failed.")
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative "twilio_phone_number_fallback_destination"
4
4
  require "date"
5
+ require_relative "twilio_phone_number_status"
5
6
  require_relative "server"
6
7
  require "ostruct"
7
8
  require "json"
@@ -23,6 +24,8 @@ module Vapi
23
24
  attr_reader :created_at
24
25
  # @return [DateTime] This is the ISO 8601 date-time string of when the phone number was last updated.
25
26
  attr_reader :updated_at
27
+ # @return [Vapi::TwilioPhoneNumberStatus] This is the status of the phone number.
28
+ attr_reader :status
26
29
  # @return [String] This is the name of the phone number. This is just for your own reference.
27
30
  attr_reader :name
28
31
  # @return [String] This is the assistant that will be used for incoming calls to this phone number.
@@ -66,6 +69,7 @@ module Vapi
66
69
  # @param org_id [String] This is the unique identifier for the org that this phone number belongs to.
67
70
  # @param created_at [DateTime] This is the ISO 8601 date-time string of when the phone number was created.
68
71
  # @param updated_at [DateTime] This is the ISO 8601 date-time string of when the phone number was last updated.
72
+ # @param status [Vapi::TwilioPhoneNumberStatus] This is the status of the phone number.
69
73
  # @param name [String] This is the name of the phone number. This is just for your own reference.
70
74
  # @param assistant_id [String] This is the assistant that will be used for incoming calls to this phone number.
71
75
  # If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent
@@ -86,13 +90,14 @@ module Vapi
86
90
  # @param twilio_auth_token [String] This is the Twilio Auth Token for the phone number.
87
91
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
88
92
  # @return [Vapi::TwilioPhoneNumber]
89
- def initialize(id:, org_id:, created_at:, updated_at:, number:, twilio_account_sid:, twilio_auth_token:, fallback_destination: OMIT, name: OMIT, assistant_id: OMIT,
90
- squad_id: OMIT, server: OMIT, additional_properties: nil)
93
+ def initialize(id:, org_id:, created_at:, updated_at:, number:, twilio_account_sid:, twilio_auth_token:, fallback_destination: OMIT, status: OMIT, name: OMIT,
94
+ assistant_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil)
91
95
  @fallback_destination = fallback_destination if fallback_destination != OMIT
92
96
  @id = id
93
97
  @org_id = org_id
94
98
  @created_at = created_at
95
99
  @updated_at = updated_at
100
+ @status = status if status != OMIT
96
101
  @name = name if name != OMIT
97
102
  @assistant_id = assistant_id if assistant_id != OMIT
98
103
  @squad_id = squad_id if squad_id != OMIT
@@ -107,6 +112,7 @@ module Vapi
107
112
  "orgId": org_id,
108
113
  "createdAt": created_at,
109
114
  "updatedAt": updated_at,
115
+ "status": status,
110
116
  "name": name,
111
117
  "assistantId": assistant_id,
112
118
  "squadId": squad_id,
@@ -136,6 +142,7 @@ module Vapi
136
142
  org_id = parsed_json["orgId"]
137
143
  created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?)
138
144
  updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?)
145
+ status = parsed_json["status"]
139
146
  name = parsed_json["name"]
140
147
  assistant_id = parsed_json["assistantId"]
141
148
  squad_id = parsed_json["squadId"]
@@ -154,6 +161,7 @@ module Vapi
154
161
  org_id: org_id,
155
162
  created_at: created_at,
156
163
  updated_at: updated_at,
164
+ status: status,
157
165
  name: name,
158
166
  assistant_id: assistant_id,
159
167
  squad_id: squad_id,
@@ -184,6 +192,7 @@ module Vapi
184
192
  obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.")
185
193
  obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.")
186
194
  obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.")
195
+ obj.status&.is_a?(Vapi::TwilioPhoneNumberStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
187
196
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
188
197
  obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.")
189
198
  obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.")
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vapi
4
+ # This is the status of the phone number.
5
+ class TwilioPhoneNumberStatus
6
+ ACTIVE = "active"
7
+ ACTIVATING = "activating"
8
+ BLOCKED = "blocked"
9
+ end
10
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  module Vapi
4
4
  class UpdateAzureOpenAiCredentialDtoModelsItem
5
+ GPT_4_O_20240806_PTU = "gpt-4o-2024-08-06-ptu"
5
6
  GPT_4_O_20240806 = "gpt-4o-2024-08-06"
6
7
  GPT_4_O_MINI_20240718 = "gpt-4o-mini-2024-07-18"
7
8
  GPT_4_O_20240513 = "gpt-4o-2024-05-13"
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "test_suite_test_scorer_ai"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module Vapi
8
+ class UpdateTestSuiteTestVoiceDto
9
+ # @return [Array<Vapi::TestSuiteTestScorerAi>] These are the scorers used to evaluate the test.
10
+ attr_reader :scorers
11
+ # @return [String] This is the name of the test.
12
+ attr_reader :name
13
+ # @return [String] This is the script to be used for the voice test.
14
+ attr_reader :script
15
+ # @return [Float] This is the number of attempts allowed for the test.
16
+ attr_reader :num_attempts
17
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
18
+ attr_reader :additional_properties
19
+ # @return [Object]
20
+ attr_reader :_field_set
21
+ protected :_field_set
22
+
23
+ OMIT = Object.new
24
+
25
+ # @param scorers [Array<Vapi::TestSuiteTestScorerAi>] These are the scorers used to evaluate the test.
26
+ # @param name [String] This is the name of the test.
27
+ # @param script [String] This is the script to be used for the voice test.
28
+ # @param num_attempts [Float] This is the number of attempts allowed for the test.
29
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
30
+ # @return [Vapi::UpdateTestSuiteTestVoiceDto]
31
+ def initialize(scorers: OMIT, name: OMIT, script: OMIT, num_attempts: OMIT, additional_properties: nil)
32
+ @scorers = scorers if scorers != OMIT
33
+ @name = name if name != OMIT
34
+ @script = script if script != OMIT
35
+ @num_attempts = num_attempts if num_attempts != OMIT
36
+ @additional_properties = additional_properties
37
+ @_field_set = {
38
+ "scorers": scorers,
39
+ "name": name,
40
+ "script": script,
41
+ "numAttempts": num_attempts
42
+ }.reject do |_k, v|
43
+ v == OMIT
44
+ end
45
+ end
46
+
47
+ # Deserialize a JSON object to an instance of UpdateTestSuiteTestVoiceDto
48
+ #
49
+ # @param json_object [String]
50
+ # @return [Vapi::UpdateTestSuiteTestVoiceDto]
51
+ def self.from_json(json_object:)
52
+ struct = JSON.parse(json_object, object_class: OpenStruct)
53
+ parsed_json = JSON.parse(json_object)
54
+ scorers = parsed_json["scorers"]&.map do |item|
55
+ item = item.to_json
56
+ Vapi::TestSuiteTestScorerAi.from_json(json_object: item)
57
+ end
58
+ name = parsed_json["name"]
59
+ script = parsed_json["script"]
60
+ num_attempts = parsed_json["numAttempts"]
61
+ new(
62
+ scorers: scorers,
63
+ name: name,
64
+ script: script,
65
+ num_attempts: num_attempts,
66
+ additional_properties: struct
67
+ )
68
+ end
69
+
70
+ # Serialize an instance of UpdateTestSuiteTestVoiceDto to a JSON object
71
+ #
72
+ # @return [String]
73
+ def to_json(*_args)
74
+ @_field_set&.to_json
75
+ end
76
+
77
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
78
+ # hash and check each fields type against the current object's property
79
+ # definitions.
80
+ #
81
+ # @param obj [Object]
82
+ # @return [Void]
83
+ def self.validate_raw(obj:)
84
+ obj.scorers&.is_a?(Array) != false || raise("Passed value for field obj.scorers is not the expected type, validation failed.")
85
+ obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
86
+ obj.script&.is_a?(String) != false || raise("Passed value for field obj.script is not the expected type, validation failed.")
87
+ obj.num_attempts&.is_a?(Float) != false || raise("Passed value for field obj.num_attempts is not the expected type, validation failed.")
88
+ end
89
+ end
90
+ end