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
@@ -20,6 +20,9 @@ module Vapi
20
20
  # - `call.phoneNumber`,
21
21
  # - `call.phoneNumberId`.
22
22
  attr_reader :phone_number
23
+ # @return [String] This is the type of the message. "status-update" is sent whenever the
24
+ # `call.status` changes.
25
+ attr_reader :type
23
26
  # @return [Vapi::ServerMessageStatusUpdateStatus] This is the status of the call.
24
27
  attr_reader :status
25
28
  # @return [Vapi::ServerMessageStatusUpdateEndedReason] This is the reason the call ended. This is only sent if the status is "ended".
@@ -80,6 +83,8 @@ module Vapi
80
83
  # This matches one of the following:
81
84
  # - `call.phoneNumber`,
82
85
  # - `call.phoneNumberId`.
86
+ # @param type [String] This is the type of the message. "status-update" is sent whenever the
87
+ # `call.status` changes.
83
88
  # @param status [Vapi::ServerMessageStatusUpdateStatus] This is the status of the call.
84
89
  # @param ended_reason [Vapi::ServerMessageStatusUpdateEndedReason] This is the reason the call ended. This is only sent if the status is "ended".
85
90
  # @param messages [Array<Vapi::ServerMessageStatusUpdateMessagesItem>] These are the conversation messages of the call. This is only sent if the status
@@ -117,9 +122,10 @@ module Vapi
117
122
  # This will include any errors related to the "assistant-request" if one was made.
118
123
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
119
124
  # @return [Vapi::ServerMessageStatusUpdate]
120
- def initialize(status:, phone_number: OMIT, ended_reason: OMIT, messages: OMIT, messages_open_ai_formatted: OMIT,
121
- destination: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT, call: OMIT, transcript: OMIT, summary: OMIT, inbound_phone_call_debugging_artifacts: OMIT, additional_properties: nil)
125
+ def initialize(type:, status:, phone_number: OMIT, ended_reason: OMIT, messages: OMIT,
126
+ messages_open_ai_formatted: OMIT, destination: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT, call: OMIT, transcript: OMIT, summary: OMIT, inbound_phone_call_debugging_artifacts: OMIT, additional_properties: nil)
122
127
  @phone_number = phone_number if phone_number != OMIT
128
+ @type = type
123
129
  @status = status
124
130
  @ended_reason = ended_reason if ended_reason != OMIT
125
131
  @messages = messages if messages != OMIT
@@ -138,6 +144,7 @@ module Vapi
138
144
  @additional_properties = additional_properties
139
145
  @_field_set = {
140
146
  "phoneNumber": phone_number,
147
+ "type": type,
141
148
  "status": status,
142
149
  "endedReason": ended_reason,
143
150
  "messages": messages,
@@ -169,6 +176,7 @@ module Vapi
169
176
  phone_number = parsed_json["phoneNumber"].to_json
170
177
  phone_number = Vapi::ServerMessageStatusUpdatePhoneNumber.from_json(json_object: phone_number)
171
178
  end
179
+ type = parsed_json["type"]
172
180
  status = parsed_json["status"]
173
181
  ended_reason = parsed_json["endedReason"]
174
182
  messages = parsed_json["messages"]&.map do |item|
@@ -215,6 +223,7 @@ module Vapi
215
223
  inbound_phone_call_debugging_artifacts = parsed_json["inboundPhoneCallDebuggingArtifacts"]
216
224
  new(
217
225
  phone_number: phone_number,
226
+ type: type,
218
227
  status: status,
219
228
  ended_reason: ended_reason,
220
229
  messages: messages,
@@ -247,6 +256,7 @@ module Vapi
247
256
  # @return [Void]
248
257
  def self.validate_raw(obj:)
249
258
  obj.phone_number.nil? || Vapi::ServerMessageStatusUpdatePhoneNumber.validate_raw(obj: obj.phone_number)
259
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
250
260
  obj.status.is_a?(Vapi::ServerMessageStatusUpdateStatus) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
251
261
  obj.ended_reason&.is_a?(Vapi::ServerMessageStatusUpdateEndedReason) != false || raise("Passed value for field obj.ended_reason is not the expected type, validation failed.")
252
262
  obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
@@ -3,7 +3,7 @@
3
3
  module Vapi
4
4
  # This is the reason the call ended. This is only sent if the status is "ended".
5
5
  class ServerMessageStatusUpdateEndedReason
6
- ASSISTANT_NOT_INVALID = "assistant-not-invalid"
6
+ ASSISTANT_NOT_VALID = "assistant-not-valid"
7
7
  ASSISTANT_NOT_PROVIDED = "assistant-not-provided"
8
8
  CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET = "call-start-error-neither-assistant-nor-server-set"
9
9
  ASSISTANT_REQUEST_FAILED = "assistant-request-failed"
@@ -14,6 +14,7 @@ module Vapi
14
14
  ASSISTANT_REQUEST_RETURNED_FORWARDING_PHONE_NUMBER = "assistant-request-returned-forwarding-phone-number"
15
15
  ASSISTANT_ENDED_CALL = "assistant-ended-call"
16
16
  ASSISTANT_SAID_END_CALL_PHRASE = "assistant-said-end-call-phrase"
17
+ ASSISTANT_ENDED_CALL_WITH_HANGUP_TASK = "assistant-ended-call-with-hangup-task"
17
18
  ASSISTANT_FORWARDED_CALL = "assistant-forwarded-call"
18
19
  ASSISTANT_JOIN_TIMED_OUT = "assistant-join-timed-out"
19
20
  CUSTOMER_BUSY = "customer-busy"
@@ -37,8 +38,10 @@ module Vapi
37
38
  PIPELINE_ERROR_RIME_AI_VOICE_FAILED = "pipeline-error-rime-ai-voice-failed"
38
39
  PIPELINE_ERROR_NEETS_VOICE_FAILED = "pipeline-error-neets-voice-failed"
39
40
  PIPELINE_ERROR_SMALLEST_AI_VOICE_FAILED = "pipeline-error-smallest-ai-voice-failed"
41
+ PIPELINE_ERROR_NEUPHONIC_VOICE_FAILED = "pipeline-error-neuphonic-voice-failed"
40
42
  PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED = "pipeline-error-deepgram-transcriber-failed"
41
43
  PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED = "pipeline-error-gladia-transcriber-failed"
44
+ PIPELINE_ERROR_SPEECHMATICS_TRANSCRIBER_FAILED = "pipeline-error-speechmatics-transcriber-failed"
42
45
  PIPELINE_ERROR_ASSEMBLY_AI_TRANSCRIBER_FAILED = "pipeline-error-assembly-ai-transcriber-failed"
43
46
  PIPELINE_ERROR_TALKSCRIBER_TRANSCRIBER_FAILED = "pipeline-error-talkscriber-transcriber-failed"
44
47
  PIPELINE_ERROR_AZURE_SPEECH_TRANSCRIBER_FAILED = "pipeline-error-azure-speech-transcriber-failed"
@@ -66,6 +69,7 @@ module Vapi
66
69
  PIPELINE_ERROR_GROQ_LLM_FAILED = "pipeline-error-groq-llm-failed"
67
70
  PIPELINE_ERROR_GOOGLE_LLM_FAILED = "pipeline-error-google-llm-failed"
68
71
  PIPELINE_ERROR_XAI_LLM_FAILED = "pipeline-error-xai-llm-failed"
72
+ PIPELINE_ERROR_MISTRAL_LLM_FAILED = "pipeline-error-mistral-llm-failed"
69
73
  PIPELINE_ERROR_INFLECTION_AI_LLM_FAILED = "pipeline-error-inflection-ai-llm-failed"
70
74
  PIPELINE_ERROR_CEREBRAS_LLM_FAILED = "pipeline-error-cerebras-llm-failed"
71
75
  PIPELINE_ERROR_DEEP_SEEK_LLM_FAILED = "pipeline-error-deep-seek-llm-failed"
@@ -84,6 +88,11 @@ module Vapi
84
88
  PIPELINE_ERROR_XAI_403_MODEL_ACCESS_DENIED = "pipeline-error-xai-403-model-access-denied"
85
89
  PIPELINE_ERROR_XAI_429_EXCEEDED_QUOTA = "pipeline-error-xai-429-exceeded-quota"
86
90
  PIPELINE_ERROR_XAI_500_SERVER_ERROR = "pipeline-error-xai-500-server-error"
91
+ PIPELINE_ERROR_MISTRAL_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-mistral-400-bad-request-validation-failed"
92
+ PIPELINE_ERROR_MISTRAL_401_UNAUTHORIZED = "pipeline-error-mistral-401-unauthorized"
93
+ PIPELINE_ERROR_MISTRAL_403_MODEL_ACCESS_DENIED = "pipeline-error-mistral-403-model-access-denied"
94
+ PIPELINE_ERROR_MISTRAL_429_EXCEEDED_QUOTA = "pipeline-error-mistral-429-exceeded-quota"
95
+ PIPELINE_ERROR_MISTRAL_500_SERVER_ERROR = "pipeline-error-mistral-500-server-error"
87
96
  PIPELINE_ERROR_INFLECTION_AI_400_BAD_REQUEST_VALIDATION_FAILED = "pipeline-error-inflection-ai-400-bad-request-validation-failed"
88
97
  PIPELINE_ERROR_INFLECTION_AI_401_UNAUTHORIZED = "pipeline-error-inflection-ai-401-unauthorized"
89
98
  PIPELINE_ERROR_INFLECTION_AI_403_MODEL_ACCESS_DENIED = "pipeline-error-inflection-ai-403-model-access-denied"
@@ -17,6 +17,8 @@ module Vapi
17
17
  # - `call.phoneNumber`,
18
18
  # - `call.phoneNumberId`.
19
19
  attr_reader :phone_number
20
+ # @return [String] This is the type of the message. "tool-calls" is sent to call a tool.
21
+ attr_reader :type
20
22
  # @return [Array<Vapi::ServerMessageToolCallsToolWithToolCallListItem>] This is the list of tools calls that the model is requesting along with the
21
23
  # original tool configuration.
22
24
  attr_reader :tool_with_tool_call_list
@@ -59,6 +61,7 @@ module Vapi
59
61
  # This matches one of the following:
60
62
  # - `call.phoneNumber`,
61
63
  # - `call.phoneNumberId`.
64
+ # @param type [String] This is the type of the message. "tool-calls" is sent to call a tool.
62
65
  # @param tool_with_tool_call_list [Array<Vapi::ServerMessageToolCallsToolWithToolCallListItem>] This is the list of tools calls that the model is requesting along with the
63
66
  # original tool configuration.
64
67
  # @param timestamp [String] This is the ISO-8601 formatted timestamp of when the message was sent.
@@ -84,9 +87,10 @@ module Vapi
84
87
  # @param tool_call_list [Array<Vapi::ToolCall>] This is the list of tool calls that the model is requesting.
85
88
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
86
89
  # @return [Vapi::ServerMessageToolCalls]
87
- def initialize(tool_with_tool_call_list:, tool_call_list:, phone_number: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT,
88
- customer: OMIT, call: OMIT, additional_properties: nil)
90
+ def initialize(tool_with_tool_call_list:, tool_call_list:, phone_number: OMIT, type: OMIT, timestamp: OMIT, artifact: OMIT,
91
+ assistant: OMIT, customer: OMIT, call: OMIT, additional_properties: nil)
89
92
  @phone_number = phone_number if phone_number != OMIT
93
+ @type = type if type != OMIT
90
94
  @tool_with_tool_call_list = tool_with_tool_call_list
91
95
  @timestamp = timestamp if timestamp != OMIT
92
96
  @artifact = artifact if artifact != OMIT
@@ -97,6 +101,7 @@ module Vapi
97
101
  @additional_properties = additional_properties
98
102
  @_field_set = {
99
103
  "phoneNumber": phone_number,
104
+ "type": type,
100
105
  "toolWithToolCallList": tool_with_tool_call_list,
101
106
  "timestamp": timestamp,
102
107
  "artifact": artifact,
@@ -122,6 +127,7 @@ module Vapi
122
127
  phone_number = parsed_json["phoneNumber"].to_json
123
128
  phone_number = Vapi::ServerMessageToolCallsPhoneNumber.from_json(json_object: phone_number)
124
129
  end
130
+ type = parsed_json["type"]
125
131
  tool_with_tool_call_list = parsed_json["toolWithToolCallList"]&.map do |item|
126
132
  item = item.to_json
127
133
  Vapi::ServerMessageToolCallsToolWithToolCallListItem.from_json(json_object: item)
@@ -157,6 +163,7 @@ module Vapi
157
163
  end
158
164
  new(
159
165
  phone_number: phone_number,
166
+ type: type,
160
167
  tool_with_tool_call_list: tool_with_tool_call_list,
161
168
  timestamp: timestamp,
162
169
  artifact: artifact,
@@ -183,6 +190,7 @@ module Vapi
183
190
  # @return [Void]
184
191
  def self.validate_raw(obj:)
185
192
  obj.phone_number.nil? || Vapi::ServerMessageToolCallsPhoneNumber.validate_raw(obj: obj.phone_number)
193
+ obj.type&.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
186
194
  obj.tool_with_tool_call_list.is_a?(Array) != false || raise("Passed value for field obj.tool_with_tool_call_list is not the expected type, validation failed.")
187
195
  obj.timestamp&.is_a?(String) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
188
196
  obj.artifact.nil? || Vapi::Artifact.validate_raw(obj: obj.artifact)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "server_message_transcript_phone_number"
4
+ require_relative "server_message_transcript_type"
4
5
  require_relative "artifact"
5
6
  require_relative "create_assistant_dto"
6
7
  require_relative "create_customer_dto"
@@ -17,6 +18,9 @@ module Vapi
17
18
  # - `call.phoneNumber`,
18
19
  # - `call.phoneNumberId`.
19
20
  attr_reader :phone_number
21
+ # @return [Vapi::ServerMessageTranscriptType] This is the type of the message. "transcript" is sent as transcriber outputs
22
+ # partial or final transcript.
23
+ attr_reader :type
20
24
  # @return [String] This is the ISO-8601 formatted timestamp of when the message was sent.
21
25
  attr_reader :timestamp
22
26
  # @return [Vapi::Artifact] This is a live version of the `call.artifact`.
@@ -60,6 +64,8 @@ module Vapi
60
64
  # This matches one of the following:
61
65
  # - `call.phoneNumber`,
62
66
  # - `call.phoneNumberId`.
67
+ # @param type [Vapi::ServerMessageTranscriptType] This is the type of the message. "transcript" is sent as transcriber outputs
68
+ # partial or final transcript.
63
69
  # @param timestamp [String] This is the ISO-8601 formatted timestamp of when the message was sent.
64
70
  # @param artifact [Vapi::Artifact] This is a live version of the `call.artifact`.
65
71
  # This matches what is stored on `call.artifact` after the call.
@@ -85,9 +91,10 @@ module Vapi
85
91
  # @param transcript [String] This is the transcript content.
86
92
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
87
93
  # @return [Vapi::ServerMessageTranscript]
88
- def initialize(role:, transcript_type:, transcript:, phone_number: OMIT, timestamp: OMIT, artifact: OMIT,
89
- assistant: OMIT, customer: OMIT, call: OMIT, additional_properties: nil)
94
+ def initialize(type:, role:, transcript_type:, transcript:, phone_number: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT,
95
+ call: OMIT, additional_properties: nil)
90
96
  @phone_number = phone_number if phone_number != OMIT
97
+ @type = type
91
98
  @timestamp = timestamp if timestamp != OMIT
92
99
  @artifact = artifact if artifact != OMIT
93
100
  @assistant = assistant if assistant != OMIT
@@ -99,6 +106,7 @@ module Vapi
99
106
  @additional_properties = additional_properties
100
107
  @_field_set = {
101
108
  "phoneNumber": phone_number,
109
+ "type": type,
102
110
  "timestamp": timestamp,
103
111
  "artifact": artifact,
104
112
  "assistant": assistant,
@@ -125,6 +133,7 @@ module Vapi
125
133
  phone_number = parsed_json["phoneNumber"].to_json
126
134
  phone_number = Vapi::ServerMessageTranscriptPhoneNumber.from_json(json_object: phone_number)
127
135
  end
136
+ type = parsed_json["type"]
128
137
  timestamp = parsed_json["timestamp"]
129
138
  if parsed_json["artifact"].nil?
130
139
  artifact = nil
@@ -155,6 +164,7 @@ module Vapi
155
164
  transcript = parsed_json["transcript"]
156
165
  new(
157
166
  phone_number: phone_number,
167
+ type: type,
158
168
  timestamp: timestamp,
159
169
  artifact: artifact,
160
170
  assistant: assistant,
@@ -182,6 +192,7 @@ module Vapi
182
192
  # @return [Void]
183
193
  def self.validate_raw(obj:)
184
194
  obj.phone_number.nil? || Vapi::ServerMessageTranscriptPhoneNumber.validate_raw(obj: obj.phone_number)
195
+ obj.type.is_a?(Vapi::ServerMessageTranscriptType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
185
196
  obj.timestamp&.is_a?(String) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
186
197
  obj.artifact.nil? || Vapi::Artifact.validate_raw(obj: obj.artifact)
187
198
  obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant)
@@ -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 ServerMessageTranscriptType
7
+ TRANSCRIPT = "transcript"
8
+ TRANSCRIPT_TRANSCRIPT_TYPE_FINAL = "transcript[transcriptType='final']"
9
+ end
10
+ end
@@ -15,6 +15,9 @@ module Vapi
15
15
  # - `call.phoneNumber`,
16
16
  # - `call.phoneNumberId`.
17
17
  attr_reader :phone_number
18
+ # @return [String] This is the type of the message. "transfer-destination-request" is sent when the
19
+ # model is requesting transfer but destination is unknown.
20
+ attr_reader :type
18
21
  # @return [String] This is the ISO-8601 formatted timestamp of when the message was sent.
19
22
  attr_reader :timestamp
20
23
  # @return [Vapi::Artifact] This is a live version of the `call.artifact`.
@@ -52,6 +55,8 @@ module Vapi
52
55
  # This matches one of the following:
53
56
  # - `call.phoneNumber`,
54
57
  # - `call.phoneNumberId`.
58
+ # @param type [String] This is the type of the message. "transfer-destination-request" is sent when the
59
+ # model is requesting transfer but destination is unknown.
55
60
  # @param timestamp [String] This is the ISO-8601 formatted timestamp of when the message was sent.
56
61
  # @param artifact [Vapi::Artifact] This is a live version of the `call.artifact`.
57
62
  # This matches what is stored on `call.artifact` after the call.
@@ -74,9 +79,10 @@ module Vapi
74
79
  # especially after the call is ended, use GET /call/:id.
75
80
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
76
81
  # @return [Vapi::ServerMessageTransferDestinationRequest]
77
- def initialize(phone_number: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT, call: OMIT,
78
- additional_properties: nil)
82
+ def initialize(type:, phone_number: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT,
83
+ call: OMIT, additional_properties: nil)
79
84
  @phone_number = phone_number if phone_number != OMIT
85
+ @type = type
80
86
  @timestamp = timestamp if timestamp != OMIT
81
87
  @artifact = artifact if artifact != OMIT
82
88
  @assistant = assistant if assistant != OMIT
@@ -85,6 +91,7 @@ module Vapi
85
91
  @additional_properties = additional_properties
86
92
  @_field_set = {
87
93
  "phoneNumber": phone_number,
94
+ "type": type,
88
95
  "timestamp": timestamp,
89
96
  "artifact": artifact,
90
97
  "assistant": assistant,
@@ -109,6 +116,7 @@ module Vapi
109
116
  phone_number = parsed_json["phoneNumber"].to_json
110
117
  phone_number = Vapi::ServerMessageTransferDestinationRequestPhoneNumber.from_json(json_object: phone_number)
111
118
  end
119
+ type = parsed_json["type"]
112
120
  timestamp = parsed_json["timestamp"]
113
121
  if parsed_json["artifact"].nil?
114
122
  artifact = nil
@@ -136,6 +144,7 @@ module Vapi
136
144
  end
137
145
  new(
138
146
  phone_number: phone_number,
147
+ type: type,
139
148
  timestamp: timestamp,
140
149
  artifact: artifact,
141
150
  assistant: assistant,
@@ -161,6 +170,7 @@ module Vapi
161
170
  # @return [Void]
162
171
  def self.validate_raw(obj:)
163
172
  obj.phone_number.nil? || Vapi::ServerMessageTransferDestinationRequestPhoneNumber.validate_raw(obj: obj.phone_number)
173
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
164
174
  obj.timestamp&.is_a?(String) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
165
175
  obj.artifact.nil? || Vapi::Artifact.validate_raw(obj: obj.artifact)
166
176
  obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant)
@@ -16,6 +16,9 @@ module Vapi
16
16
  # - `call.phoneNumber`,
17
17
  # - `call.phoneNumberId`.
18
18
  attr_reader :phone_number
19
+ # @return [String] This is the type of the message. "transfer-update" is sent whenever a transfer
20
+ # happens.
21
+ attr_reader :type
19
22
  # @return [Vapi::ServerMessageTransferUpdateDestination] This is the destination of the transfer.
20
23
  attr_reader :destination
21
24
  # @return [String] This is the ISO-8601 formatted timestamp of when the message was sent.
@@ -65,6 +68,8 @@ module Vapi
65
68
  # This matches one of the following:
66
69
  # - `call.phoneNumber`,
67
70
  # - `call.phoneNumberId`.
71
+ # @param type [String] This is the type of the message. "transfer-update" is sent whenever a transfer
72
+ # happens.
68
73
  # @param destination [Vapi::ServerMessageTransferUpdateDestination] This is the destination of the transfer.
69
74
  # @param timestamp [String] This is the ISO-8601 formatted timestamp of when the message was sent.
70
75
  # @param artifact [Vapi::Artifact] This is a live version of the `call.artifact`.
@@ -94,9 +99,10 @@ module Vapi
94
99
  # @param from_step_record [Hash{String => Object}] This is the step that the conversation moved from. =
95
100
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
96
101
  # @return [Vapi::ServerMessageTransferUpdate]
97
- def initialize(phone_number: OMIT, destination: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT,
102
+ def initialize(type:, phone_number: OMIT, destination: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT,
98
103
  customer: OMIT, call: OMIT, to_assistant: OMIT, from_assistant: OMIT, to_step_record: OMIT, from_step_record: OMIT, additional_properties: nil)
99
104
  @phone_number = phone_number if phone_number != OMIT
105
+ @type = type
100
106
  @destination = destination if destination != OMIT
101
107
  @timestamp = timestamp if timestamp != OMIT
102
108
  @artifact = artifact if artifact != OMIT
@@ -110,6 +116,7 @@ module Vapi
110
116
  @additional_properties = additional_properties
111
117
  @_field_set = {
112
118
  "phoneNumber": phone_number,
119
+ "type": type,
113
120
  "destination": destination,
114
121
  "timestamp": timestamp,
115
122
  "artifact": artifact,
@@ -138,6 +145,7 @@ module Vapi
138
145
  phone_number = parsed_json["phoneNumber"].to_json
139
146
  phone_number = Vapi::ServerMessageTransferUpdatePhoneNumber.from_json(json_object: phone_number)
140
147
  end
148
+ type = parsed_json["type"]
141
149
  if parsed_json["destination"].nil?
142
150
  destination = nil
143
151
  else
@@ -185,6 +193,7 @@ module Vapi
185
193
  from_step_record = parsed_json["fromStepRecord"]
186
194
  new(
187
195
  phone_number: phone_number,
196
+ type: type,
188
197
  destination: destination,
189
198
  timestamp: timestamp,
190
199
  artifact: artifact,
@@ -214,6 +223,7 @@ module Vapi
214
223
  # @return [Void]
215
224
  def self.validate_raw(obj:)
216
225
  obj.phone_number.nil? || Vapi::ServerMessageTransferUpdatePhoneNumber.validate_raw(obj: obj.phone_number)
226
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
217
227
  obj.destination.nil? || Vapi::ServerMessageTransferUpdateDestination.validate_raw(obj: obj.destination)
218
228
  obj.timestamp&.is_a?(String) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
219
229
  obj.artifact.nil? || Vapi::Artifact.validate_raw(obj: obj.artifact)
@@ -15,6 +15,9 @@ module Vapi
15
15
  # - `call.phoneNumber`,
16
16
  # - `call.phoneNumberId`.
17
17
  attr_reader :phone_number
18
+ # @return [String] This is the type of the message. "user-interrupted" is sent when the user
19
+ # interrupts the assistant.
20
+ attr_reader :type
18
21
  # @return [String] This is the ISO-8601 formatted timestamp of when the message was sent.
19
22
  attr_reader :timestamp
20
23
  # @return [Vapi::Artifact] This is a live version of the `call.artifact`.
@@ -52,6 +55,8 @@ module Vapi
52
55
  # This matches one of the following:
53
56
  # - `call.phoneNumber`,
54
57
  # - `call.phoneNumberId`.
58
+ # @param type [String] This is the type of the message. "user-interrupted" is sent when the user
59
+ # interrupts the assistant.
55
60
  # @param timestamp [String] This is the ISO-8601 formatted timestamp of when the message was sent.
56
61
  # @param artifact [Vapi::Artifact] This is a live version of the `call.artifact`.
57
62
  # This matches what is stored on `call.artifact` after the call.
@@ -74,9 +79,10 @@ module Vapi
74
79
  # especially after the call is ended, use GET /call/:id.
75
80
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
76
81
  # @return [Vapi::ServerMessageUserInterrupted]
77
- def initialize(phone_number: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT, call: OMIT,
78
- additional_properties: nil)
82
+ def initialize(type:, phone_number: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT,
83
+ call: OMIT, additional_properties: nil)
79
84
  @phone_number = phone_number if phone_number != OMIT
85
+ @type = type
80
86
  @timestamp = timestamp if timestamp != OMIT
81
87
  @artifact = artifact if artifact != OMIT
82
88
  @assistant = assistant if assistant != OMIT
@@ -85,6 +91,7 @@ module Vapi
85
91
  @additional_properties = additional_properties
86
92
  @_field_set = {
87
93
  "phoneNumber": phone_number,
94
+ "type": type,
88
95
  "timestamp": timestamp,
89
96
  "artifact": artifact,
90
97
  "assistant": assistant,
@@ -108,6 +115,7 @@ module Vapi
108
115
  phone_number = parsed_json["phoneNumber"].to_json
109
116
  phone_number = Vapi::ServerMessageUserInterruptedPhoneNumber.from_json(json_object: phone_number)
110
117
  end
118
+ type = parsed_json["type"]
111
119
  timestamp = parsed_json["timestamp"]
112
120
  if parsed_json["artifact"].nil?
113
121
  artifact = nil
@@ -135,6 +143,7 @@ module Vapi
135
143
  end
136
144
  new(
137
145
  phone_number: phone_number,
146
+ type: type,
138
147
  timestamp: timestamp,
139
148
  artifact: artifact,
140
149
  assistant: assistant,
@@ -159,6 +168,7 @@ module Vapi
159
168
  # @return [Void]
160
169
  def self.validate_raw(obj:)
161
170
  obj.phone_number.nil? || Vapi::ServerMessageUserInterruptedPhoneNumber.validate_raw(obj: obj.phone_number)
171
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
162
172
  obj.timestamp&.is_a?(String) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
163
173
  obj.artifact.nil? || Vapi::Artifact.validate_raw(obj: obj.artifact)
164
174
  obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant)
@@ -15,6 +15,9 @@ module Vapi
15
15
  # - `call.phoneNumber`,
16
16
  # - `call.phoneNumberId`.
17
17
  attr_reader :phone_number
18
+ # @return [String] This is the type of the message. "voice-input" is sent when a generation is
19
+ # requested from voice provider.
20
+ attr_reader :type
18
21
  # @return [String] This is the ISO-8601 formatted timestamp of when the message was sent.
19
22
  attr_reader :timestamp
20
23
  # @return [Vapi::Artifact] This is a live version of the `call.artifact`.
@@ -54,6 +57,8 @@ module Vapi
54
57
  # This matches one of the following:
55
58
  # - `call.phoneNumber`,
56
59
  # - `call.phoneNumberId`.
60
+ # @param type [String] This is the type of the message. "voice-input" is sent when a generation is
61
+ # requested from voice provider.
57
62
  # @param timestamp [String] This is the ISO-8601 formatted timestamp of when the message was sent.
58
63
  # @param artifact [Vapi::Artifact] This is a live version of the `call.artifact`.
59
64
  # This matches what is stored on `call.artifact` after the call.
@@ -77,9 +82,10 @@ module Vapi
77
82
  # @param input [String] This is the voice input content
78
83
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
79
84
  # @return [Vapi::ServerMessageVoiceInput]
80
- def initialize(input:, phone_number: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT,
85
+ def initialize(type:, input:, phone_number: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT,
81
86
  call: OMIT, additional_properties: nil)
82
87
  @phone_number = phone_number if phone_number != OMIT
88
+ @type = type
83
89
  @timestamp = timestamp if timestamp != OMIT
84
90
  @artifact = artifact if artifact != OMIT
85
91
  @assistant = assistant if assistant != OMIT
@@ -89,6 +95,7 @@ module Vapi
89
95
  @additional_properties = additional_properties
90
96
  @_field_set = {
91
97
  "phoneNumber": phone_number,
98
+ "type": type,
92
99
  "timestamp": timestamp,
93
100
  "artifact": artifact,
94
101
  "assistant": assistant,
@@ -113,6 +120,7 @@ module Vapi
113
120
  phone_number = parsed_json["phoneNumber"].to_json
114
121
  phone_number = Vapi::ServerMessageVoiceInputPhoneNumber.from_json(json_object: phone_number)
115
122
  end
123
+ type = parsed_json["type"]
116
124
  timestamp = parsed_json["timestamp"]
117
125
  if parsed_json["artifact"].nil?
118
126
  artifact = nil
@@ -141,6 +149,7 @@ module Vapi
141
149
  input = parsed_json["input"]
142
150
  new(
143
151
  phone_number: phone_number,
152
+ type: type,
144
153
  timestamp: timestamp,
145
154
  artifact: artifact,
146
155
  assistant: assistant,
@@ -166,6 +175,7 @@ module Vapi
166
175
  # @return [Void]
167
176
  def self.validate_raw(obj:)
168
177
  obj.phone_number.nil? || Vapi::ServerMessageVoiceInputPhoneNumber.validate_raw(obj: obj.phone_number)
178
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
169
179
  obj.timestamp&.is_a?(String) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
170
180
  obj.artifact.nil? || Vapi::Artifact.validate_raw(obj: obj.artifact)
171
181
  obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant)
@@ -15,6 +15,28 @@ module Vapi
15
15
  # - `call.phoneNumber`,
16
16
  # - `call.phoneNumberId`.
17
17
  attr_reader :phone_number
18
+ # @return [String] This is the type of the message. "voice-request" is sent when using
19
+ # `assistant.voice={ "type": "custom-voice" }`.
20
+ # Here is what the request will look like:
21
+ # POST https://{assistant.voice.server.url}
22
+ # Content-Type: application/json
23
+ # {
24
+ # "messsage": {
25
+ # "type": "voice-request",
26
+ # "text": "Hello, world!",
27
+ # "sampleRate": 24000,
28
+ # ...other metadata about the call...
29
+ # }
30
+ # }
31
+ # The expected response is 1-channel 16-bit raw PCM audio at the sample rate
32
+ # specified in the request. Here is how the response will be piped to the
33
+ # transport:
34
+ # ```
35
+ # response.on('data', (chunk: Buffer) => {
36
+ # outputStream.write(chunk);
37
+ # });
38
+ # ```
39
+ attr_reader :type
18
40
  # @return [String] This is the ISO-8601 formatted timestamp of when the message was sent.
19
41
  attr_reader :timestamp
20
42
  # @return [Vapi::Artifact] This is a live version of the `call.artifact`.
@@ -56,6 +78,27 @@ module Vapi
56
78
  # This matches one of the following:
57
79
  # - `call.phoneNumber`,
58
80
  # - `call.phoneNumberId`.
81
+ # @param type [String] This is the type of the message. "voice-request" is sent when using
82
+ # `assistant.voice={ "type": "custom-voice" }`.
83
+ # Here is what the request will look like:
84
+ # POST https://{assistant.voice.server.url}
85
+ # Content-Type: application/json
86
+ # {
87
+ # "messsage": {
88
+ # "type": "voice-request",
89
+ # "text": "Hello, world!",
90
+ # "sampleRate": 24000,
91
+ # ...other metadata about the call...
92
+ # }
93
+ # }
94
+ # The expected response is 1-channel 16-bit raw PCM audio at the sample rate
95
+ # specified in the request. Here is how the response will be piped to the
96
+ # transport:
97
+ # ```
98
+ # response.on('data', (chunk: Buffer) => {
99
+ # outputStream.write(chunk);
100
+ # });
101
+ # ```
59
102
  # @param timestamp [String] This is the ISO-8601 formatted timestamp of when the message was sent.
60
103
  # @param artifact [Vapi::Artifact] This is a live version of the `call.artifact`.
61
104
  # This matches what is stored on `call.artifact` after the call.
@@ -80,9 +123,10 @@ module Vapi
80
123
  # @param sample_rate [Float] This is the sample rate to be synthesized.
81
124
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
82
125
  # @return [Vapi::ServerMessageVoiceRequest]
83
- def initialize(text:, sample_rate:, phone_number: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT,
84
- customer: OMIT, call: OMIT, additional_properties: nil)
126
+ def initialize(type:, text:, sample_rate:, phone_number: OMIT, timestamp: OMIT, artifact: OMIT, assistant: OMIT, customer: OMIT,
127
+ call: OMIT, additional_properties: nil)
85
128
  @phone_number = phone_number if phone_number != OMIT
129
+ @type = type
86
130
  @timestamp = timestamp if timestamp != OMIT
87
131
  @artifact = artifact if artifact != OMIT
88
132
  @assistant = assistant if assistant != OMIT
@@ -93,6 +137,7 @@ module Vapi
93
137
  @additional_properties = additional_properties
94
138
  @_field_set = {
95
139
  "phoneNumber": phone_number,
140
+ "type": type,
96
141
  "timestamp": timestamp,
97
142
  "artifact": artifact,
98
143
  "assistant": assistant,
@@ -118,6 +163,7 @@ module Vapi
118
163
  phone_number = parsed_json["phoneNumber"].to_json
119
164
  phone_number = Vapi::ServerMessageVoiceRequestPhoneNumber.from_json(json_object: phone_number)
120
165
  end
166
+ type = parsed_json["type"]
121
167
  timestamp = parsed_json["timestamp"]
122
168
  if parsed_json["artifact"].nil?
123
169
  artifact = nil
@@ -147,6 +193,7 @@ module Vapi
147
193
  sample_rate = parsed_json["sampleRate"]
148
194
  new(
149
195
  phone_number: phone_number,
196
+ type: type,
150
197
  timestamp: timestamp,
151
198
  artifact: artifact,
152
199
  assistant: assistant,
@@ -173,6 +220,7 @@ module Vapi
173
220
  # @return [Void]
174
221
  def self.validate_raw(obj:)
175
222
  obj.phone_number.nil? || Vapi::ServerMessageVoiceRequestPhoneNumber.validate_raw(obj: obj.phone_number)
223
+ obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
176
224
  obj.timestamp&.is_a?(String) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
177
225
  obj.artifact.nil? || Vapi::Artifact.validate_raw(obj: obj.artifact)
178
226
  obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant)