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
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "client_message_transcript_type"
3
4
  require_relative "client_message_transcript_role"
4
5
  require_relative "client_message_transcript_transcript_type"
5
6
  require "ostruct"
@@ -7,6 +8,9 @@ require "json"
7
8
 
8
9
  module Vapi
9
10
  class ClientMessageTranscript
11
+ # @return [Vapi::ClientMessageTranscriptType] This is the type of the message. "transcript" is sent as transcriber outputs
12
+ # partial or final transcript.
13
+ attr_reader :type
10
14
  # @return [Vapi::ClientMessageTranscriptRole] This is the role for which the transcript is for.
11
15
  attr_reader :role
12
16
  # @return [Vapi::ClientMessageTranscriptTranscriptType] This is the type of the transcript.
@@ -21,17 +25,20 @@ module Vapi
21
25
 
22
26
  OMIT = Object.new
23
27
 
28
+ # @param type [Vapi::ClientMessageTranscriptType] This is the type of the message. "transcript" is sent as transcriber outputs
29
+ # partial or final transcript.
24
30
  # @param role [Vapi::ClientMessageTranscriptRole] This is the role for which the transcript is for.
25
31
  # @param transcript_type [Vapi::ClientMessageTranscriptTranscriptType] This is the type of the transcript.
26
32
  # @param transcript [String] This is the transcript content.
27
33
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
28
34
  # @return [Vapi::ClientMessageTranscript]
29
- def initialize(role:, transcript_type:, transcript:, additional_properties: nil)
35
+ def initialize(type:, role:, transcript_type:, transcript:, additional_properties: nil)
36
+ @type = type
30
37
  @role = role
31
38
  @transcript_type = transcript_type
32
39
  @transcript = transcript
33
40
  @additional_properties = additional_properties
34
- @_field_set = { "role": role, "transcriptType": transcript_type, "transcript": transcript }
41
+ @_field_set = { "type": type, "role": role, "transcriptType": transcript_type, "transcript": transcript }
35
42
  end
36
43
 
37
44
  # Deserialize a JSON object to an instance of ClientMessageTranscript
@@ -41,10 +48,12 @@ module Vapi
41
48
  def self.from_json(json_object:)
42
49
  struct = JSON.parse(json_object, object_class: OpenStruct)
43
50
  parsed_json = JSON.parse(json_object)
51
+ type = parsed_json["type"]
44
52
  role = parsed_json["role"]
45
53
  transcript_type = parsed_json["transcriptType"]
46
54
  transcript = parsed_json["transcript"]
47
55
  new(
56
+ type: type,
48
57
  role: role,
49
58
  transcript_type: transcript_type,
50
59
  transcript: transcript,
@@ -66,6 +75,7 @@ module Vapi
66
75
  # @param obj [Object]
67
76
  # @return [Void]
68
77
  def self.validate_raw(obj:)
78
+ obj.type.is_a?(Vapi::ClientMessageTranscriptType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
69
79
  obj.role.is_a?(Vapi::ClientMessageTranscriptRole) != false || raise("Passed value for field obj.role is not the expected type, validation failed.")
70
80
  obj.transcript_type.is_a?(Vapi::ClientMessageTranscriptTranscriptType) != false || raise("Passed value for field obj.transcript_type is not the expected type, validation failed.")
71
81
  obj.transcript.is_a?(String) != false || raise("Passed value for field obj.transcript is not the expected type, validation failed.")
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vapi
4
+ # This is the type of the message. "transcript" is sent as transcriber outputs
5
+ # partial or final transcript.
6
+ class ClientMessageTranscriptType
7
+ TRANSCRIPT = "transcript"
8
+ TRANSCRIPT_TRANSCRIPT_TYPE_FINAL = "transcript[transcriptType='final']"
9
+ end
10
+ end
@@ -7,6 +7,9 @@ require "json"
7
7
 
8
8
  module Vapi
9
9
  class ClientMessageTransferUpdate
10
+ # @return [String] This is the type of the message. "transfer-update" is sent whenever a transfer
11
+ # happens.
12
+ attr_reader :type
10
13
  # @return [Vapi::ClientMessageTransferUpdateDestination] This is the destination of the transfer.
11
14
  attr_reader :destination
12
15
  # @return [Vapi::CreateAssistantDto] This is the assistant that the call is being transferred to. This is only sent
@@ -27,6 +30,8 @@ module Vapi
27
30
 
28
31
  OMIT = Object.new
29
32
 
33
+ # @param type [String] This is the type of the message. "transfer-update" is sent whenever a transfer
34
+ # happens.
30
35
  # @param destination [Vapi::ClientMessageTransferUpdateDestination] This is the destination of the transfer.
31
36
  # @param to_assistant [Vapi::CreateAssistantDto] This is the assistant that the call is being transferred to. This is only sent
32
37
  # if `destination.type` is "assistant".
@@ -36,8 +41,9 @@ module Vapi
36
41
  # @param from_step_record [Hash{String => Object}] This is the step that the conversation moved from. =
37
42
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
38
43
  # @return [Vapi::ClientMessageTransferUpdate]
39
- def initialize(destination: OMIT, to_assistant: OMIT, from_assistant: OMIT, to_step_record: OMIT,
44
+ def initialize(type:, destination: OMIT, to_assistant: OMIT, from_assistant: OMIT, to_step_record: OMIT,
40
45
  from_step_record: OMIT, additional_properties: nil)
46
+ @type = type
41
47
  @destination = destination if destination != OMIT
42
48
  @to_assistant = to_assistant if to_assistant != OMIT
43
49
  @from_assistant = from_assistant if from_assistant != OMIT
@@ -45,6 +51,7 @@ module Vapi
45
51
  @from_step_record = from_step_record if from_step_record != OMIT
46
52
  @additional_properties = additional_properties
47
53
  @_field_set = {
54
+ "type": type,
48
55
  "destination": destination,
49
56
  "toAssistant": to_assistant,
50
57
  "fromAssistant": from_assistant,
@@ -62,6 +69,7 @@ module Vapi
62
69
  def self.from_json(json_object:)
63
70
  struct = JSON.parse(json_object, object_class: OpenStruct)
64
71
  parsed_json = JSON.parse(json_object)
72
+ type = parsed_json["type"]
65
73
  if parsed_json["destination"].nil?
66
74
  destination = nil
67
75
  else
@@ -83,6 +91,7 @@ module Vapi
83
91
  to_step_record = parsed_json["toStepRecord"]
84
92
  from_step_record = parsed_json["fromStepRecord"]
85
93
  new(
94
+ type: type,
86
95
  destination: destination,
87
96
  to_assistant: to_assistant,
88
97
  from_assistant: from_assistant,
@@ -106,6 +115,7 @@ module Vapi
106
115
  # @param obj [Object]
107
116
  # @return [Void]
108
117
  def self.validate_raw(obj:)
118
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
109
119
  obj.destination.nil? || Vapi::ClientMessageTransferUpdateDestination.validate_raw(obj: obj.destination)
110
120
  obj.to_assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.to_assistant)
111
121
  obj.from_assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.from_assistant)
@@ -5,6 +5,9 @@ require "json"
5
5
 
6
6
  module Vapi
7
7
  class ClientMessageUserInterrupted
8
+ # @return [String] This is the type of the message. "user-interrupted" is sent when the user
9
+ # interrupts the assistant.
10
+ attr_reader :type
8
11
  # @return [OpenStruct] Additional properties unmapped to the current class definition
9
12
  attr_reader :additional_properties
10
13
  # @return [Object]
@@ -13,11 +16,14 @@ module Vapi
13
16
 
14
17
  OMIT = Object.new
15
18
 
19
+ # @param type [String] This is the type of the message. "user-interrupted" is sent when the user
20
+ # interrupts the assistant.
16
21
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
17
22
  # @return [Vapi::ClientMessageUserInterrupted]
18
- def initialize(additional_properties: nil)
23
+ def initialize(type:, additional_properties: nil)
24
+ @type = type
19
25
  @additional_properties = additional_properties
20
- @_field_set = {}
26
+ @_field_set = { "type": type }
21
27
  end
22
28
 
23
29
  # Deserialize a JSON object to an instance of ClientMessageUserInterrupted
@@ -26,7 +32,9 @@ module Vapi
26
32
  # @return [Vapi::ClientMessageUserInterrupted]
27
33
  def self.from_json(json_object:)
28
34
  struct = JSON.parse(json_object, object_class: OpenStruct)
29
- new(additional_properties: struct)
35
+ parsed_json = JSON.parse(json_object)
36
+ type = parsed_json["type"]
37
+ new(type: type, additional_properties: struct)
30
38
  end
31
39
 
32
40
  # Serialize an instance of ClientMessageUserInterrupted to a JSON object
@@ -42,6 +50,8 @@ module Vapi
42
50
  #
43
51
  # @param obj [Object]
44
52
  # @return [Void]
45
- def self.validate_raw(obj:); end
53
+ def self.validate_raw(obj:)
54
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
55
+ end
46
56
  end
47
57
  end
@@ -5,6 +5,9 @@ require "json"
5
5
 
6
6
  module Vapi
7
7
  class ClientMessageVoiceInput
8
+ # @return [String] This is the type of the message. "voice-input" is sent when a generation is
9
+ # requested from voice provider.
10
+ attr_reader :type
8
11
  # @return [String] This is the voice input content
9
12
  attr_reader :input
10
13
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -15,13 +18,16 @@ module Vapi
15
18
 
16
19
  OMIT = Object.new
17
20
 
21
+ # @param type [String] This is the type of the message. "voice-input" is sent when a generation is
22
+ # requested from voice provider.
18
23
  # @param input [String] This is the voice input content
19
24
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
20
25
  # @return [Vapi::ClientMessageVoiceInput]
21
- def initialize(input:, additional_properties: nil)
26
+ def initialize(type:, input:, additional_properties: nil)
27
+ @type = type
22
28
  @input = input
23
29
  @additional_properties = additional_properties
24
- @_field_set = { "input": input }
30
+ @_field_set = { "type": type, "input": input }
25
31
  end
26
32
 
27
33
  # Deserialize a JSON object to an instance of ClientMessageVoiceInput
@@ -31,8 +37,13 @@ module Vapi
31
37
  def self.from_json(json_object:)
32
38
  struct = JSON.parse(json_object, object_class: OpenStruct)
33
39
  parsed_json = JSON.parse(json_object)
40
+ type = parsed_json["type"]
34
41
  input = parsed_json["input"]
35
- new(input: input, additional_properties: struct)
42
+ new(
43
+ type: type,
44
+ input: input,
45
+ additional_properties: struct
46
+ )
36
47
  end
37
48
 
38
49
  # Serialize an instance of ClientMessageVoiceInput to a JSON object
@@ -49,6 +60,7 @@ module Vapi
49
60
  # @param obj [Object]
50
61
  # @return [Void]
51
62
  def self.validate_raw(obj:)
63
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
52
64
  obj.input.is_a?(String) != false || raise("Passed value for field obj.input is not the expected type, validation failed.")
53
65
  end
54
66
  end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vapi
7
+ class ClientMessageWorkflowNodeStarted
8
+ # @return [String] This is the type of the message. "workflow.node.started" is sent when the active
9
+ # node changes.
10
+ attr_reader :type
11
+ # @return [Hash{String => Object}] This is the active node.
12
+ attr_reader :node
13
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
14
+ attr_reader :additional_properties
15
+ # @return [Object]
16
+ attr_reader :_field_set
17
+ protected :_field_set
18
+
19
+ OMIT = Object.new
20
+
21
+ # @param type [String] This is the type of the message. "workflow.node.started" is sent when the active
22
+ # node changes.
23
+ # @param node [Hash{String => Object}] This is the active node.
24
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
25
+ # @return [Vapi::ClientMessageWorkflowNodeStarted]
26
+ def initialize(type:, node:, additional_properties: nil)
27
+ @type = type
28
+ @node = node
29
+ @additional_properties = additional_properties
30
+ @_field_set = { "type": type, "node": node }
31
+ end
32
+
33
+ # Deserialize a JSON object to an instance of ClientMessageWorkflowNodeStarted
34
+ #
35
+ # @param json_object [String]
36
+ # @return [Vapi::ClientMessageWorkflowNodeStarted]
37
+ def self.from_json(json_object:)
38
+ struct = JSON.parse(json_object, object_class: OpenStruct)
39
+ parsed_json = JSON.parse(json_object)
40
+ type = parsed_json["type"]
41
+ node = parsed_json["node"]
42
+ new(
43
+ type: type,
44
+ node: node,
45
+ additional_properties: struct
46
+ )
47
+ end
48
+
49
+ # Serialize an instance of ClientMessageWorkflowNodeStarted to a JSON object
50
+ #
51
+ # @return [String]
52
+ def to_json(*_args)
53
+ @_field_set&.to_json
54
+ end
55
+
56
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
57
+ # hash and check each fields type against the current object's property
58
+ # definitions.
59
+ #
60
+ # @param obj [Object]
61
+ # @return [Void]
62
+ def self.validate_raw(obj:)
63
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
64
+ obj.node.is_a?(Hash) != false || raise("Passed value for field obj.node is not the expected type, validation failed.")
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vapi
7
+ class CompliancePlan
8
+ # @return [Boolean] When this is enabled, no logs, recordings, or transcriptions will be stored. At
9
+ # the end of the call, you will still receive an end-of-call-report message to
10
+ # store on your server. Defaults to false.
11
+ attr_reader :hipaa_enabled
12
+ # @return [Boolean] When this is enabled, the user will be restricted to use PCI-compliant
13
+ # providers, and no logs or transcripts are stored. At the end of the call, you
14
+ # will receive an end-of-call-report message to store on your server. Defaults to
15
+ # false.
16
+ attr_reader :pci_enabled
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 hipaa_enabled [Boolean] When this is enabled, no logs, recordings, or transcriptions will be stored. At
26
+ # the end of the call, you will still receive an end-of-call-report message to
27
+ # store on your server. Defaults to false.
28
+ # @param pci_enabled [Boolean] When this is enabled, the user will be restricted to use PCI-compliant
29
+ # providers, and no logs or transcripts are stored. At the end of the call, you
30
+ # will receive an end-of-call-report message to store on your server. Defaults to
31
+ # false.
32
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
33
+ # @return [Vapi::CompliancePlan]
34
+ def initialize(hipaa_enabled: OMIT, pci_enabled: OMIT, additional_properties: nil)
35
+ @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT
36
+ @pci_enabled = pci_enabled if pci_enabled != OMIT
37
+ @additional_properties = additional_properties
38
+ @_field_set = { "hipaaEnabled": hipaa_enabled, "pciEnabled": pci_enabled }.reject do |_k, v|
39
+ v == OMIT
40
+ end
41
+ end
42
+
43
+ # Deserialize a JSON object to an instance of CompliancePlan
44
+ #
45
+ # @param json_object [String]
46
+ # @return [Vapi::CompliancePlan]
47
+ def self.from_json(json_object:)
48
+ struct = JSON.parse(json_object, object_class: OpenStruct)
49
+ parsed_json = JSON.parse(json_object)
50
+ hipaa_enabled = parsed_json["hipaaEnabled"]
51
+ pci_enabled = parsed_json["pciEnabled"]
52
+ new(
53
+ hipaa_enabled: hipaa_enabled,
54
+ pci_enabled: pci_enabled,
55
+ additional_properties: struct
56
+ )
57
+ end
58
+
59
+ # Serialize an instance of CompliancePlan to a JSON object
60
+ #
61
+ # @return [String]
62
+ def to_json(*_args)
63
+ @_field_set&.to_json
64
+ end
65
+
66
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
67
+ # hash and check each fields type against the current object's property
68
+ # definitions.
69
+ #
70
+ # @param obj [Object]
71
+ # @return [Void]
72
+ def self.validate_raw(obj:)
73
+ obj.hipaa_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.hipaa_enabled is not the expected type, validation failed.")
74
+ obj.pci_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.pci_enabled is not the expected type, validation failed.")
75
+ end
76
+ end
77
+ end
@@ -10,6 +10,7 @@ require_relative "create_assistant_dto_background_sound"
10
10
  require_relative "transport_configuration_twilio"
11
11
  require_relative "create_assistant_dto_credentials_item"
12
12
  require_relative "twilio_voicemail_detection"
13
+ require_relative "compliance_plan"
13
14
  require_relative "analysis_plan"
14
15
  require_relative "artifact_plan"
15
16
  require_relative "message_plan"
@@ -17,6 +18,7 @@ require_relative "start_speaking_plan"
17
18
  require_relative "stop_speaking_plan"
18
19
  require_relative "monitor_plan"
19
20
  require_relative "server"
21
+ require_relative "assistant_hooks"
20
22
  require "ostruct"
21
23
  require "json"
22
24
 
@@ -44,10 +46,6 @@ module Vapi
44
46
  # transfer points).
45
47
  # @default 'assistant-speaks-first'
46
48
  attr_reader :first_message_mode
47
- # @return [Boolean] When this is enabled, no logs, recordings, or transcriptions will be stored. At
48
- # the end of the call, you will still receive an end-of-call-report message to
49
- # store on your server. Defaults to false.
50
- attr_reader :hipaa_enabled
51
49
  # @return [Array<Vapi::CreateAssistantDtoClientMessagesItem>] These are the messages that will be sent to your Client SDKs. Default is
52
50
  # tatus-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input.
53
51
  # You can check the shape of the messages in ClientMessage schema.
@@ -106,6 +104,8 @@ module Vapi
106
104
  # @return [Array<String>] This list contains phrases that, if spoken by the assistant, will trigger the
107
105
  # call to be hung up. Case insensitive.
108
106
  attr_reader :end_call_phrases
107
+ # @return [Vapi::CompliancePlan]
108
+ attr_reader :compliance_plan
109
109
  # @return [Hash{String => Object}] This is for metadata you want to store on the assistant.
110
110
  attr_reader :metadata
111
111
  # @return [Vapi::AnalysisPlan] This is the plan for analysis of assistant's calls. Stored in `call.analysis`.
@@ -160,6 +160,8 @@ module Vapi
160
160
  # 2. phoneNumber.serverUrl
161
161
  # 3. org.serverUrl
162
162
  attr_reader :server
163
+ # @return [Array<Vapi::AssistantHooks>] This is a set of actions that will be performed on certain events.
164
+ attr_reader :hooks
163
165
  # @return [OpenStruct] Additional properties unmapped to the current class definition
164
166
  attr_reader :additional_properties
165
167
  # @return [Object]
@@ -185,9 +187,6 @@ module Vapi
185
187
  # state. (`assistant.model.messages` at call start, `call.messages` at squad
186
188
  # transfer points).
187
189
  # @default 'assistant-speaks-first'
188
- # @param hipaa_enabled [Boolean] When this is enabled, no logs, recordings, or transcriptions will be stored. At
189
- # the end of the call, you will still receive an end-of-call-report message to
190
- # store on your server. Defaults to false.
191
190
  # @param client_messages [Array<Vapi::CreateAssistantDtoClientMessagesItem>] These are the messages that will be sent to your Client SDKs. Default is
192
191
  # tatus-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input.
193
192
  # You can check the shape of the messages in ClientMessage schema.
@@ -232,6 +231,7 @@ module Vapi
232
231
  # If unspecified, it will hang up without saying anything.
233
232
  # @param end_call_phrases [Array<String>] This list contains phrases that, if spoken by the assistant, will trigger the
234
233
  # call to be hung up. Case insensitive.
234
+ # @param compliance_plan [Vapi::CompliancePlan]
235
235
  # @param metadata [Hash{String => Object}] This is for metadata you want to store on the assistant.
236
236
  # @param analysis_plan [Vapi::AnalysisPlan] This is the plan for analysis of assistant's calls. Stored in `call.analysis`.
237
237
  # @param artifact_plan [Vapi::ArtifactPlan] This is the plan for artifacts generated during assistant's calls. Stored in
@@ -277,16 +277,16 @@ module Vapi
277
277
  # 1. assistant.server.url
278
278
  # 2. phoneNumber.serverUrl
279
279
  # 3. org.serverUrl
280
+ # @param hooks [Array<Vapi::AssistantHooks>] This is a set of actions that will be performed on certain events.
280
281
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
281
282
  # @return [Vapi::CreateAssistantDto]
282
283
  def initialize(transcriber: OMIT, model: OMIT, voice: OMIT, first_message: OMIT, first_message_mode: OMIT,
283
- hipaa_enabled: OMIT, client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, credentials: OMIT, name: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, metadata: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, server: OMIT, additional_properties: nil)
284
+ client_messages: OMIT, server_messages: OMIT, silence_timeout_seconds: OMIT, max_duration_seconds: OMIT, background_sound: OMIT, background_denoising_enabled: OMIT, model_output_in_messages_enabled: OMIT, transport_configurations: OMIT, credentials: OMIT, name: OMIT, voicemail_detection: OMIT, voicemail_message: OMIT, end_call_message: OMIT, end_call_phrases: OMIT, compliance_plan: OMIT, metadata: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, message_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, credential_ids: OMIT, server: OMIT, hooks: OMIT, additional_properties: nil)
284
285
  @transcriber = transcriber if transcriber != OMIT
285
286
  @model = model if model != OMIT
286
287
  @voice = voice if voice != OMIT
287
288
  @first_message = first_message if first_message != OMIT
288
289
  @first_message_mode = first_message_mode if first_message_mode != OMIT
289
- @hipaa_enabled = hipaa_enabled if hipaa_enabled != OMIT
290
290
  @client_messages = client_messages if client_messages != OMIT
291
291
  @server_messages = server_messages if server_messages != OMIT
292
292
  @silence_timeout_seconds = silence_timeout_seconds if silence_timeout_seconds != OMIT
@@ -301,6 +301,7 @@ module Vapi
301
301
  @voicemail_message = voicemail_message if voicemail_message != OMIT
302
302
  @end_call_message = end_call_message if end_call_message != OMIT
303
303
  @end_call_phrases = end_call_phrases if end_call_phrases != OMIT
304
+ @compliance_plan = compliance_plan if compliance_plan != OMIT
304
305
  @metadata = metadata if metadata != OMIT
305
306
  @analysis_plan = analysis_plan if analysis_plan != OMIT
306
307
  @artifact_plan = artifact_plan if artifact_plan != OMIT
@@ -310,6 +311,7 @@ module Vapi
310
311
  @monitor_plan = monitor_plan if monitor_plan != OMIT
311
312
  @credential_ids = credential_ids if credential_ids != OMIT
312
313
  @server = server if server != OMIT
314
+ @hooks = hooks if hooks != OMIT
313
315
  @additional_properties = additional_properties
314
316
  @_field_set = {
315
317
  "transcriber": transcriber,
@@ -317,7 +319,6 @@ module Vapi
317
319
  "voice": voice,
318
320
  "firstMessage": first_message,
319
321
  "firstMessageMode": first_message_mode,
320
- "hipaaEnabled": hipaa_enabled,
321
322
  "clientMessages": client_messages,
322
323
  "serverMessages": server_messages,
323
324
  "silenceTimeoutSeconds": silence_timeout_seconds,
@@ -332,6 +333,7 @@ module Vapi
332
333
  "voicemailMessage": voicemail_message,
333
334
  "endCallMessage": end_call_message,
334
335
  "endCallPhrases": end_call_phrases,
336
+ "compliancePlan": compliance_plan,
335
337
  "metadata": metadata,
336
338
  "analysisPlan": analysis_plan,
337
339
  "artifactPlan": artifact_plan,
@@ -340,7 +342,8 @@ module Vapi
340
342
  "stopSpeakingPlan": stop_speaking_plan,
341
343
  "monitorPlan": monitor_plan,
342
344
  "credentialIds": credential_ids,
343
- "server": server
345
+ "server": server,
346
+ "hooks": hooks
344
347
  }.reject do |_k, v|
345
348
  v == OMIT
346
349
  end
@@ -373,7 +376,6 @@ module Vapi
373
376
  end
374
377
  first_message = parsed_json["firstMessage"]
375
378
  first_message_mode = parsed_json["firstMessageMode"]
376
- hipaa_enabled = parsed_json["hipaaEnabled"]
377
379
  client_messages = parsed_json["clientMessages"]
378
380
  server_messages = parsed_json["serverMessages"]
379
381
  silence_timeout_seconds = parsed_json["silenceTimeoutSeconds"]
@@ -399,6 +401,12 @@ module Vapi
399
401
  voicemail_message = parsed_json["voicemailMessage"]
400
402
  end_call_message = parsed_json["endCallMessage"]
401
403
  end_call_phrases = parsed_json["endCallPhrases"]
404
+ if parsed_json["compliancePlan"].nil?
405
+ compliance_plan = nil
406
+ else
407
+ compliance_plan = parsed_json["compliancePlan"].to_json
408
+ compliance_plan = Vapi::CompliancePlan.from_json(json_object: compliance_plan)
409
+ end
402
410
  metadata = parsed_json["metadata"]
403
411
  if parsed_json["analysisPlan"].nil?
404
412
  analysis_plan = nil
@@ -443,13 +451,16 @@ module Vapi
443
451
  server = parsed_json["server"].to_json
444
452
  server = Vapi::Server.from_json(json_object: server)
445
453
  end
454
+ hooks = parsed_json["hooks"]&.map do |item|
455
+ item = item.to_json
456
+ Vapi::AssistantHooks.from_json(json_object: item)
457
+ end
446
458
  new(
447
459
  transcriber: transcriber,
448
460
  model: model,
449
461
  voice: voice,
450
462
  first_message: first_message,
451
463
  first_message_mode: first_message_mode,
452
- hipaa_enabled: hipaa_enabled,
453
464
  client_messages: client_messages,
454
465
  server_messages: server_messages,
455
466
  silence_timeout_seconds: silence_timeout_seconds,
@@ -464,6 +475,7 @@ module Vapi
464
475
  voicemail_message: voicemail_message,
465
476
  end_call_message: end_call_message,
466
477
  end_call_phrases: end_call_phrases,
478
+ compliance_plan: compliance_plan,
467
479
  metadata: metadata,
468
480
  analysis_plan: analysis_plan,
469
481
  artifact_plan: artifact_plan,
@@ -473,6 +485,7 @@ module Vapi
473
485
  monitor_plan: monitor_plan,
474
486
  credential_ids: credential_ids,
475
487
  server: server,
488
+ hooks: hooks,
476
489
  additional_properties: struct
477
490
  )
478
491
  end
@@ -496,7 +509,6 @@ module Vapi
496
509
  obj.voice.nil? || Vapi::CreateAssistantDtoVoice.validate_raw(obj: obj.voice)
497
510
  obj.first_message&.is_a?(String) != false || raise("Passed value for field obj.first_message is not the expected type, validation failed.")
498
511
  obj.first_message_mode&.is_a?(Vapi::CreateAssistantDtoFirstMessageMode) != false || raise("Passed value for field obj.first_message_mode is not the expected type, validation failed.")
499
- obj.hipaa_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.hipaa_enabled is not the expected type, validation failed.")
500
512
  obj.client_messages&.is_a?(Array) != false || raise("Passed value for field obj.client_messages is not the expected type, validation failed.")
501
513
  obj.server_messages&.is_a?(Array) != false || raise("Passed value for field obj.server_messages is not the expected type, validation failed.")
502
514
  obj.silence_timeout_seconds&.is_a?(Float) != false || raise("Passed value for field obj.silence_timeout_seconds is not the expected type, validation failed.")
@@ -511,6 +523,7 @@ module Vapi
511
523
  obj.voicemail_message&.is_a?(String) != false || raise("Passed value for field obj.voicemail_message is not the expected type, validation failed.")
512
524
  obj.end_call_message&.is_a?(String) != false || raise("Passed value for field obj.end_call_message is not the expected type, validation failed.")
513
525
  obj.end_call_phrases&.is_a?(Array) != false || raise("Passed value for field obj.end_call_phrases is not the expected type, validation failed.")
526
+ obj.compliance_plan.nil? || Vapi::CompliancePlan.validate_raw(obj: obj.compliance_plan)
514
527
  obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
515
528
  obj.analysis_plan.nil? || Vapi::AnalysisPlan.validate_raw(obj: obj.analysis_plan)
516
529
  obj.artifact_plan.nil? || Vapi::ArtifactPlan.validate_raw(obj: obj.artifact_plan)
@@ -520,6 +533,7 @@ module Vapi
520
533
  obj.monitor_plan.nil? || Vapi::MonitorPlan.validate_raw(obj: obj.monitor_plan)
521
534
  obj.credential_ids&.is_a?(Array) != false || raise("Passed value for field obj.credential_ids is not the expected type, validation failed.")
522
535
  obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server)
536
+ obj.hooks&.is_a?(Array) != false || raise("Passed value for field obj.hooks is not the expected type, validation failed.")
523
537
  end
524
538
  end
525
539
  end
@@ -13,6 +13,7 @@ module Vapi
13
13
  SPEECH_UPDATE = "speech-update"
14
14
  STATUS_UPDATE = "status-update"
15
15
  TRANSCRIPT = "transcript"
16
+ TRANSCRIPT_TRANSCRIPT_TYPE_FINAL = "transcript[transcriptType='final']"
16
17
  TOOL_CALLS = "tool-calls"
17
18
  TRANSFER_DESTINATION_REQUEST = "transfer-destination-request"
18
19
  TRANSFER_UPDATE = "transfer-update"
@@ -2,6 +2,7 @@
2
2
 
3
3
  module Vapi
4
4
  class CreateAzureOpenAiCredentialDtoModelsItem
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"