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,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 CreateTestSuiteTestVoiceDto
9
+ # @return [Array<Vapi::TestSuiteTestScorerAi>] These are the scorers used to evaluate the test.
10
+ attr_reader :scorers
11
+ # @return [String] This is the script to be used for the voice test.
12
+ attr_reader :script
13
+ # @return [Float] This is the number of attempts allowed for the test.
14
+ attr_reader :num_attempts
15
+ # @return [String] This is the name of the test.
16
+ attr_reader :name
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 script [String] This is the script to be used for the voice test.
27
+ # @param num_attempts [Float] This is the number of attempts allowed for the test.
28
+ # @param name [String] This is the name of the test.
29
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
30
+ # @return [Vapi::CreateTestSuiteTestVoiceDto]
31
+ def initialize(scorers:, script:, num_attempts: OMIT, name: OMIT, additional_properties: nil)
32
+ @scorers = scorers
33
+ @script = script
34
+ @num_attempts = num_attempts if num_attempts != OMIT
35
+ @name = name if name != OMIT
36
+ @additional_properties = additional_properties
37
+ @_field_set = {
38
+ "scorers": scorers,
39
+ "script": script,
40
+ "numAttempts": num_attempts,
41
+ "name": name
42
+ }.reject do |_k, v|
43
+ v == OMIT
44
+ end
45
+ end
46
+
47
+ # Deserialize a JSON object to an instance of CreateTestSuiteTestVoiceDto
48
+ #
49
+ # @param json_object [String]
50
+ # @return [Vapi::CreateTestSuiteTestVoiceDto]
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
+ script = parsed_json["script"]
59
+ num_attempts = parsed_json["numAttempts"]
60
+ name = parsed_json["name"]
61
+ new(
62
+ scorers: scorers,
63
+ script: script,
64
+ num_attempts: num_attempts,
65
+ name: name,
66
+ additional_properties: struct
67
+ )
68
+ end
69
+
70
+ # Serialize an instance of CreateTestSuiteTestVoiceDto 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.script.is_a?(String) != false || raise("Passed value for field obj.script is not the expected type, validation failed.")
86
+ obj.num_attempts&.is_a?(Float) != false || raise("Passed value for field obj.num_attempts is not the expected type, validation failed.")
87
+ obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
88
+ end
89
+ end
90
+ end
@@ -15,6 +15,8 @@ module Vapi
15
15
  # If this is not set and above conditions are met, the inbound call is hung up
16
16
  # with an error message.
17
17
  attr_reader :fallback_destination
18
+ # @return [String] This is the area code of the phone number to purchase.
19
+ attr_reader :number_desired_area_code
18
20
  # @return [String] This is the SIP URI of the phone number. You can SIP INVITE this. The assistant
19
21
  # attached to this number will answer.
20
22
  # This is case-insensitive.
@@ -56,6 +58,7 @@ module Vapi
56
58
  # 3. and, `assistant-request` message to the `serverUrl` fails
57
59
  # If this is not set and above conditions are met, the inbound call is hung up
58
60
  # with an error message.
61
+ # @param number_desired_area_code [String] This is the area code of the phone number to purchase.
59
62
  # @param sip_uri [String] This is the SIP URI of the phone number. You can SIP INVITE this. The assistant
60
63
  # attached to this number will answer.
61
64
  # This is case-insensitive.
@@ -79,10 +82,11 @@ module Vapi
79
82
  # 3. org.server
80
83
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
81
84
  # @return [Vapi::CreateVapiPhoneNumberDto]
82
- def initialize(sip_uri:, fallback_destination: OMIT, authentication: OMIT, name: OMIT, assistant_id: OMIT,
83
- squad_id: OMIT, server: OMIT, additional_properties: nil)
85
+ def initialize(fallback_destination: OMIT, number_desired_area_code: OMIT, sip_uri: OMIT, authentication: OMIT,
86
+ name: OMIT, assistant_id: OMIT, squad_id: OMIT, server: OMIT, additional_properties: nil)
84
87
  @fallback_destination = fallback_destination if fallback_destination != OMIT
85
- @sip_uri = sip_uri
88
+ @number_desired_area_code = number_desired_area_code if number_desired_area_code != OMIT
89
+ @sip_uri = sip_uri if sip_uri != OMIT
86
90
  @authentication = authentication if authentication != OMIT
87
91
  @name = name if name != OMIT
88
92
  @assistant_id = assistant_id if assistant_id != OMIT
@@ -91,6 +95,7 @@ module Vapi
91
95
  @additional_properties = additional_properties
92
96
  @_field_set = {
93
97
  "fallbackDestination": fallback_destination,
98
+ "numberDesiredAreaCode": number_desired_area_code,
94
99
  "sipUri": sip_uri,
95
100
  "authentication": authentication,
96
101
  "name": name,
@@ -115,6 +120,7 @@ module Vapi
115
120
  fallback_destination = parsed_json["fallbackDestination"].to_json
116
121
  fallback_destination = Vapi::CreateVapiPhoneNumberDtoFallbackDestination.from_json(json_object: fallback_destination)
117
122
  end
123
+ number_desired_area_code = parsed_json["numberDesiredAreaCode"]
118
124
  sip_uri = parsed_json["sipUri"]
119
125
  if parsed_json["authentication"].nil?
120
126
  authentication = nil
@@ -133,6 +139,7 @@ module Vapi
133
139
  end
134
140
  new(
135
141
  fallback_destination: fallback_destination,
142
+ number_desired_area_code: number_desired_area_code,
136
143
  sip_uri: sip_uri,
137
144
  authentication: authentication,
138
145
  name: name,
@@ -158,7 +165,8 @@ module Vapi
158
165
  # @return [Void]
159
166
  def self.validate_raw(obj:)
160
167
  obj.fallback_destination.nil? || Vapi::CreateVapiPhoneNumberDtoFallbackDestination.validate_raw(obj: obj.fallback_destination)
161
- obj.sip_uri.is_a?(String) != false || raise("Passed value for field obj.sip_uri is not the expected type, validation failed.")
168
+ obj.number_desired_area_code&.is_a?(String) != false || raise("Passed value for field obj.number_desired_area_code is not the expected type, validation failed.")
169
+ obj.sip_uri&.is_a?(String) != false || raise("Passed value for field obj.sip_uri is not the expected type, validation failed.")
162
170
  obj.authentication.nil? || Vapi::SipAuthentication.validate_raw(obj: obj.authentication)
163
171
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
164
172
  obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.")
@@ -7,8 +7,6 @@ require "json"
7
7
 
8
8
  module Vapi
9
9
  class CreateWorkflowDto
10
- # @return [String]
11
- attr_reader :type
12
10
  # @return [Array<Vapi::CreateWorkflowDtoNodesItem>]
13
11
  attr_reader :nodes
14
12
  # @return [String]
@@ -23,19 +21,17 @@ module Vapi
23
21
 
24
22
  OMIT = Object.new
25
23
 
26
- # @param type [String]
27
24
  # @param nodes [Array<Vapi::CreateWorkflowDtoNodesItem>]
28
25
  # @param name [String]
29
26
  # @param edges [Array<Vapi::Edge>]
30
27
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
31
28
  # @return [Vapi::CreateWorkflowDto]
32
- def initialize(type:, nodes:, name:, edges:, additional_properties: nil)
33
- @type = type
29
+ def initialize(nodes:, name:, edges:, additional_properties: nil)
34
30
  @nodes = nodes
35
31
  @name = name
36
32
  @edges = edges
37
33
  @additional_properties = additional_properties
38
- @_field_set = { "type": type, "nodes": nodes, "name": name, "edges": edges }
34
+ @_field_set = { "nodes": nodes, "name": name, "edges": edges }
39
35
  end
40
36
 
41
37
  # Deserialize a JSON object to an instance of CreateWorkflowDto
@@ -45,7 +41,6 @@ module Vapi
45
41
  def self.from_json(json_object:)
46
42
  struct = JSON.parse(json_object, object_class: OpenStruct)
47
43
  parsed_json = JSON.parse(json_object)
48
- type = parsed_json["type"]
49
44
  nodes = parsed_json["nodes"]&.map do |item|
50
45
  item = item.to_json
51
46
  Vapi::CreateWorkflowDtoNodesItem.from_json(json_object: item)
@@ -56,7 +51,6 @@ module Vapi
56
51
  Vapi::Edge.from_json(json_object: item)
57
52
  end
58
53
  new(
59
- type: type,
60
54
  nodes: nodes,
61
55
  name: name,
62
56
  edges: edges,
@@ -78,7 +72,6 @@ module Vapi
78
72
  # @param obj [Object]
79
73
  # @return [Void]
80
74
  def self.validate_raw(obj:)
81
- obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
82
75
  obj.nodes.is_a?(Array) != false || raise("Passed value for field obj.nodes is not the expected type, validation failed.")
83
76
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
84
77
  obj.edges.is_a?(Array) != false || raise("Passed value for field obj.edges is not the expected type, validation failed.")
@@ -3,49 +3,70 @@
3
3
  require "json"
4
4
  require_relative "say"
5
5
  require_relative "gather"
6
- require_relative "create_workflow_dto"
6
+ require_relative "api_request"
7
+ require_relative "hangup"
8
+ require_relative "transfer"
7
9
 
8
10
  module Vapi
9
11
  class CreateWorkflowDtoNodesItem
12
+ # @return [Object]
13
+ attr_reader :member
14
+ # @return [String]
15
+ attr_reader :discriminant
16
+
17
+ private_class_method :new
18
+ alias kind_of? is_a?
19
+
20
+ # @param member [Object]
21
+ # @param discriminant [String]
22
+ # @return [Vapi::CreateWorkflowDtoNodesItem]
23
+ def initialize(member:, discriminant:)
24
+ @member = member
25
+ @discriminant = discriminant
26
+ end
27
+
10
28
  # Deserialize a JSON object to an instance of CreateWorkflowDtoNodesItem
11
29
  #
12
30
  # @param json_object [String]
13
31
  # @return [Vapi::CreateWorkflowDtoNodesItem]
14
32
  def self.from_json(json_object:)
15
33
  struct = JSON.parse(json_object, object_class: OpenStruct)
16
- begin
17
- Vapi::Say.validate_raw(obj: struct)
18
- return Vapi::Say.from_json(json_object: struct) unless struct.nil?
19
-
20
- return nil
21
- rescue StandardError
22
- # noop
23
- end
24
- begin
25
- Vapi::Gather.validate_raw(obj: struct)
26
- return Vapi::Gather.from_json(json_object: struct) unless struct.nil?
27
-
28
- return nil
29
- rescue StandardError
30
- # noop
31
- end
32
- begin
33
- struct.is_a?(Object) != false || raise("Passed value for field struct is not the expected type, validation failed.")
34
- return struct unless struct.nil?
35
-
36
- return nil
37
- rescue StandardError
38
- # noop
39
- end
40
- begin
41
- Vapi::CreateWorkflowDto.validate_raw(obj: struct)
42
- return Vapi::CreateWorkflowDto.from_json(json_object: struct) unless struct.nil?
34
+ member = case struct.type
35
+ when "say"
36
+ Vapi::Say.from_json(json_object: json_object)
37
+ when "gather"
38
+ Vapi::Gather.from_json(json_object: json_object)
39
+ when "apiRequest"
40
+ Vapi::ApiRequest.from_json(json_object: json_object)
41
+ when "hangup"
42
+ Vapi::Hangup.from_json(json_object: json_object)
43
+ when "transfer"
44
+ Vapi::Transfer.from_json(json_object: json_object)
45
+ else
46
+ Vapi::Say.from_json(json_object: json_object)
47
+ end
48
+ new(member: member, discriminant: struct.type)
49
+ end
43
50
 
44
- return nil
45
- rescue StandardError
46
- # noop
51
+ # For Union Types, to_json functionality is delegated to the wrapped member.
52
+ #
53
+ # @return [String]
54
+ def to_json(*_args)
55
+ case @discriminant
56
+ when "say"
57
+ { **@member.to_json, type: @discriminant }.to_json
58
+ when "gather"
59
+ { **@member.to_json, type: @discriminant }.to_json
60
+ when "apiRequest"
61
+ { **@member.to_json, type: @discriminant }.to_json
62
+ when "hangup"
63
+ { **@member.to_json, type: @discriminant }.to_json
64
+ when "transfer"
65
+ { **@member.to_json, type: @discriminant }.to_json
66
+ else
67
+ { "type": @discriminant, value: @member }.to_json
47
68
  end
48
- struct
69
+ @member.to_json
49
70
  end
50
71
 
51
72
  # Leveraged for Union-type generation, validate_raw attempts to parse the given
@@ -55,27 +76,58 @@ module Vapi
55
76
  # @param obj [Object]
56
77
  # @return [Void]
57
78
  def self.validate_raw(obj:)
58
- begin
59
- return Vapi::Say.validate_raw(obj: obj)
60
- rescue StandardError
61
- # noop
62
- end
63
- begin
64
- return Vapi::Gather.validate_raw(obj: obj)
65
- rescue StandardError
66
- # noop
79
+ case obj.type
80
+ when "say"
81
+ Vapi::Say.validate_raw(obj: obj)
82
+ when "gather"
83
+ Vapi::Gather.validate_raw(obj: obj)
84
+ when "apiRequest"
85
+ Vapi::ApiRequest.validate_raw(obj: obj)
86
+ when "hangup"
87
+ Vapi::Hangup.validate_raw(obj: obj)
88
+ when "transfer"
89
+ Vapi::Transfer.validate_raw(obj: obj)
90
+ else
91
+ raise("Passed value matched no type within the union, validation failed.")
67
92
  end
68
- begin
69
- return obj.is_a?(Object) != false || raise("Passed value for field obj is not the expected type, validation failed.")
70
- rescue StandardError
71
- # noop
72
- end
73
- begin
74
- return Vapi::CreateWorkflowDto.validate_raw(obj: obj)
75
- rescue StandardError
76
- # noop
77
- end
78
- raise("Passed value matched no type within the union, validation failed.")
93
+ end
94
+
95
+ # For Union Types, is_a? functionality is delegated to the wrapped member.
96
+ #
97
+ # @param obj [Object]
98
+ # @return [Boolean]
99
+ def is_a?(obj)
100
+ @member.is_a?(obj)
101
+ end
102
+
103
+ # @param member [Vapi::Say]
104
+ # @return [Vapi::CreateWorkflowDtoNodesItem]
105
+ def self.say(member:)
106
+ new(member: member, discriminant: "say")
107
+ end
108
+
109
+ # @param member [Vapi::Gather]
110
+ # @return [Vapi::CreateWorkflowDtoNodesItem]
111
+ def self.gather(member:)
112
+ new(member: member, discriminant: "gather")
113
+ end
114
+
115
+ # @param member [Vapi::ApiRequest]
116
+ # @return [Vapi::CreateWorkflowDtoNodesItem]
117
+ def self.api_request(member:)
118
+ new(member: member, discriminant: "apiRequest")
119
+ end
120
+
121
+ # @param member [Vapi::Hangup]
122
+ # @return [Vapi::CreateWorkflowDtoNodesItem]
123
+ def self.hangup(member:)
124
+ new(member: member, discriminant: "hangup")
125
+ end
126
+
127
+ # @param member [Vapi::Transfer]
128
+ # @return [Vapi::CreateWorkflowDtoNodesItem]
129
+ def self.transfer(member:)
130
+ new(member: member, discriminant: "transfer")
79
131
  end
80
132
  end
81
133
  end
@@ -3,6 +3,7 @@
3
3
  require_relative "open_ai_message"
4
4
  require_relative "deep_seek_model_tools_item"
5
5
  require_relative "create_custom_knowledge_base_dto"
6
+ require_relative "deep_seek_model_model"
6
7
  require "ostruct"
7
8
  require "json"
8
9
 
@@ -22,7 +23,7 @@ module Vapi
22
23
  attr_reader :knowledge_base
23
24
  # @return [String] This is the ID of the knowledge base the model will use.
24
25
  attr_reader :knowledge_base_id
25
- # @return [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b
26
+ # @return [Vapi::DeepSeekModelModel] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b
26
27
  attr_reader :model
27
28
  # @return [Float] This is the temperature that will be used for calls. Default is 0 to leverage
28
29
  # caching for lower latency.
@@ -59,7 +60,7 @@ module Vapi
59
60
  # Both `tools` and `toolIds` can be used together.
60
61
  # @param knowledge_base [Vapi::CreateCustomKnowledgeBaseDto] These are the options for the knowledge base.
61
62
  # @param knowledge_base_id [String] This is the ID of the knowledge base the model will use.
62
- # @param model [String] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b
63
+ # @param model [Vapi::DeepSeekModelModel] This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b
63
64
  # @param temperature [Float] This is the temperature that will be used for calls. Default is 0 to leverage
64
65
  # caching for lower latency.
65
66
  # @param max_tokens [Float] This is the max number of tokens that the assistant will be allowed to generate
@@ -167,7 +168,7 @@ module Vapi
167
168
  obj.tool_ids&.is_a?(Array) != false || raise("Passed value for field obj.tool_ids is not the expected type, validation failed.")
168
169
  obj.knowledge_base.nil? || Vapi::CreateCustomKnowledgeBaseDto.validate_raw(obj: obj.knowledge_base)
169
170
  obj.knowledge_base_id&.is_a?(String) != false || raise("Passed value for field obj.knowledge_base_id is not the expected type, validation failed.")
170
- obj.model.is_a?(String) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
171
+ obj.model.is_a?(Vapi::DeepSeekModelModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
171
172
  obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.")
172
173
  obj.max_tokens&.is_a?(Float) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.")
173
174
  obj.emotion_recognition_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.emotion_recognition_enabled is not the expected type, validation failed.")
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vapi
4
+ # This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b
5
+ class DeepSeekModelModel
6
+ DEEPSEEK_CHAT = "deepseek-chat"
7
+ DEEPSEEK_REASONER = "deepseek-reasoner"
8
+ end
9
+ end
@@ -49,10 +49,19 @@ module Vapi
49
49
  # `assistant.serverMessages`.
50
50
  # @default false
51
51
  attr_reader :code_switching_enabled
52
+ # @return [Boolean] If set to true, this will add mip_opt_out=true as a query parameter of all API
53
+ # requests. See
54
+ # gram.com/docs/the-deepgram-model-improvement-partnership-program#want-to-opt-out
55
+ # This will only be used if you are using your own Deepgram API key.
56
+ # @default false
57
+ attr_reader :mip_opt_out
52
58
  # @return [Array<String>] These keywords are passed to the transcription model to help it pick up use-case
53
59
  # specific words. Anything that may not be a common word, like your company name,
54
60
  # should be added here.
55
61
  attr_reader :keywords
62
+ # @return [Array<String>] Keyterm Prompting allows you improve Keyword Recall Rate (KRR) for important
63
+ # keyterms or phrases up to 90%.
64
+ attr_reader :keyterm
56
65
  # @return [Float] This is the timeout after which Deepgram will send transcription on user
57
66
  # silence. You can read in-depth documentation here:
58
67
  # https://developers.deepgram.com/docs/endpointing.
@@ -113,9 +122,16 @@ module Vapi
113
122
  # - To receive `language-change-detected` webhook events, add it to
114
123
  # `assistant.serverMessages`.
115
124
  # @default false
125
+ # @param mip_opt_out [Boolean] If set to true, this will add mip_opt_out=true as a query parameter of all API
126
+ # requests. See
127
+ # gram.com/docs/the-deepgram-model-improvement-partnership-program#want-to-opt-out
128
+ # This will only be used if you are using your own Deepgram API key.
129
+ # @default false
116
130
  # @param keywords [Array<String>] These keywords are passed to the transcription model to help it pick up use-case
117
131
  # specific words. Anything that may not be a common word, like your company name,
118
132
  # should be added here.
133
+ # @param keyterm [Array<String>] Keyterm Prompting allows you improve Keyword Recall Rate (KRR) for important
134
+ # keyterms or phrases up to 90%.
119
135
  # @param endpointing [Float] This is the timeout after which Deepgram will send transcription on user
120
136
  # silence. You can read in-depth documentation here:
121
137
  # https://developers.deepgram.com/docs/endpointing.
@@ -131,13 +147,15 @@ module Vapi
131
147
  # @default 10
132
148
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
133
149
  # @return [Vapi::DeepgramTranscriber]
134
- def initialize(model: OMIT, language: OMIT, smart_format: OMIT, code_switching_enabled: OMIT, keywords: OMIT,
135
- endpointing: OMIT, additional_properties: nil)
150
+ def initialize(model: OMIT, language: OMIT, smart_format: OMIT, code_switching_enabled: OMIT, mip_opt_out: OMIT,
151
+ keywords: OMIT, keyterm: OMIT, endpointing: OMIT, additional_properties: nil)
136
152
  @model = model if model != OMIT
137
153
  @language = language if language != OMIT
138
154
  @smart_format = smart_format if smart_format != OMIT
139
155
  @code_switching_enabled = code_switching_enabled if code_switching_enabled != OMIT
156
+ @mip_opt_out = mip_opt_out if mip_opt_out != OMIT
140
157
  @keywords = keywords if keywords != OMIT
158
+ @keyterm = keyterm if keyterm != OMIT
141
159
  @endpointing = endpointing if endpointing != OMIT
142
160
  @additional_properties = additional_properties
143
161
  @_field_set = {
@@ -145,7 +163,9 @@ module Vapi
145
163
  "language": language,
146
164
  "smartFormat": smart_format,
147
165
  "codeSwitchingEnabled": code_switching_enabled,
166
+ "mipOptOut": mip_opt_out,
148
167
  "keywords": keywords,
168
+ "keyterm": keyterm,
149
169
  "endpointing": endpointing
150
170
  }.reject do |_k, v|
151
171
  v == OMIT
@@ -163,14 +183,18 @@ module Vapi
163
183
  language = parsed_json["language"]
164
184
  smart_format = parsed_json["smartFormat"]
165
185
  code_switching_enabled = parsed_json["codeSwitchingEnabled"]
186
+ mip_opt_out = parsed_json["mipOptOut"]
166
187
  keywords = parsed_json["keywords"]
188
+ keyterm = parsed_json["keyterm"]
167
189
  endpointing = parsed_json["endpointing"]
168
190
  new(
169
191
  model: model,
170
192
  language: language,
171
193
  smart_format: smart_format,
172
194
  code_switching_enabled: code_switching_enabled,
195
+ mip_opt_out: mip_opt_out,
173
196
  keywords: keywords,
197
+ keyterm: keyterm,
174
198
  endpointing: endpointing,
175
199
  additional_properties: struct
176
200
  )
@@ -194,7 +218,9 @@ module Vapi
194
218
  obj.language&.is_a?(Vapi::DeepgramTranscriberLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.")
195
219
  obj.smart_format&.is_a?(Boolean) != false || raise("Passed value for field obj.smart_format is not the expected type, validation failed.")
196
220
  obj.code_switching_enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.code_switching_enabled is not the expected type, validation failed.")
221
+ obj.mip_opt_out&.is_a?(Boolean) != false || raise("Passed value for field obj.mip_opt_out is not the expected type, validation failed.")
197
222
  obj.keywords&.is_a?(Array) != false || raise("Passed value for field obj.keywords is not the expected type, validation failed.")
223
+ obj.keyterm&.is_a?(Array) != false || raise("Passed value for field obj.keyterm is not the expected type, validation failed.")
198
224
  obj.endpointing&.is_a?(Float) != false || raise("Passed value for field obj.endpointing is not the expected type, validation failed.")
199
225
  end
200
226
  end
@@ -10,6 +10,12 @@ module Vapi
10
10
  class DeepgramVoice
11
11
  # @return [Vapi::DeepgramVoiceId] This is the provider-specific ID that will be used.
12
12
  attr_reader :voice_id
13
+ # @return [Boolean] If set to true, this will add mip_opt_out=true as a query parameter of all API
14
+ # requests. See
15
+ # gram.com/docs/the-deepgram-model-improvement-partnership-program#want-to-opt-out
16
+ # This will only be used if you are using your own Deepgram API key.
17
+ # @default false
18
+ attr_reader :mip_opt_out
13
19
  # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice
14
20
  # provider.
15
21
  attr_reader :chunk_plan
@@ -25,18 +31,29 @@ module Vapi
25
31
  OMIT = Object.new
26
32
 
27
33
  # @param voice_id [Vapi::DeepgramVoiceId] This is the provider-specific ID that will be used.
34
+ # @param mip_opt_out [Boolean] If set to true, this will add mip_opt_out=true as a query parameter of all API
35
+ # requests. See
36
+ # gram.com/docs/the-deepgram-model-improvement-partnership-program#want-to-opt-out
37
+ # This will only be used if you are using your own Deepgram API key.
38
+ # @default false
28
39
  # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice
29
40
  # provider.
30
41
  # @param fallback_plan [Vapi::FallbackPlan] This is the plan for voice provider fallbacks in the event that the primary
31
42
  # voice provider fails.
32
43
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
33
44
  # @return [Vapi::DeepgramVoice]
34
- def initialize(voice_id:, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil)
45
+ def initialize(voice_id:, mip_opt_out: OMIT, chunk_plan: OMIT, fallback_plan: OMIT, additional_properties: nil)
35
46
  @voice_id = voice_id
47
+ @mip_opt_out = mip_opt_out if mip_opt_out != OMIT
36
48
  @chunk_plan = chunk_plan if chunk_plan != OMIT
37
49
  @fallback_plan = fallback_plan if fallback_plan != OMIT
38
50
  @additional_properties = additional_properties
39
- @_field_set = { "voiceId": voice_id, "chunkPlan": chunk_plan, "fallbackPlan": fallback_plan }.reject do |_k, v|
51
+ @_field_set = {
52
+ "voiceId": voice_id,
53
+ "mipOptOut": mip_opt_out,
54
+ "chunkPlan": chunk_plan,
55
+ "fallbackPlan": fallback_plan
56
+ }.reject do |_k, v|
40
57
  v == OMIT
41
58
  end
42
59
  end
@@ -54,6 +71,7 @@ module Vapi
54
71
  voice_id = parsed_json["voiceId"].to_json
55
72
  voice_id = Vapi::DeepgramVoiceId.from_json(json_object: voice_id)
56
73
  end
74
+ mip_opt_out = parsed_json["mipOptOut"]
57
75
  if parsed_json["chunkPlan"].nil?
58
76
  chunk_plan = nil
59
77
  else
@@ -68,6 +86,7 @@ module Vapi
68
86
  end
69
87
  new(
70
88
  voice_id: voice_id,
89
+ mip_opt_out: mip_opt_out,
71
90
  chunk_plan: chunk_plan,
72
91
  fallback_plan: fallback_plan,
73
92
  additional_properties: struct
@@ -89,6 +108,7 @@ module Vapi
89
108
  # @return [Void]
90
109
  def self.validate_raw(obj:)
91
110
  Vapi::DeepgramVoiceId.validate_raw(obj: obj.voice_id)
111
+ obj.mip_opt_out&.is_a?(Boolean) != false || raise("Passed value for field obj.mip_opt_out is not the expected type, validation failed.")
92
112
  obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan)
93
113
  obj.fallback_plan.nil? || Vapi::FallbackPlan.validate_raw(obj: obj.fallback_plan)
94
114
  end
@@ -12,6 +12,8 @@ module Vapi
12
12
  attr_reader :from
13
13
  # @return [String]
14
14
  attr_reader :to
15
+ # @return [Hash{String => Object}] This is for metadata you want to store on the edge.
16
+ attr_reader :metadata
15
17
  # @return [OpenStruct] Additional properties unmapped to the current class definition
16
18
  attr_reader :additional_properties
17
19
  # @return [Object]
@@ -23,14 +25,16 @@ module Vapi
23
25
  # @param condition [Vapi::EdgeCondition]
24
26
  # @param from [String]
25
27
  # @param to [String]
28
+ # @param metadata [Hash{String => Object}] This is for metadata you want to store on the edge.
26
29
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
30
  # @return [Vapi::Edge]
28
- def initialize(from:, to:, condition: OMIT, additional_properties: nil)
31
+ def initialize(from:, to:, condition: OMIT, metadata: OMIT, additional_properties: nil)
29
32
  @condition = condition if condition != OMIT
30
33
  @from = from
31
34
  @to = to
35
+ @metadata = metadata if metadata != OMIT
32
36
  @additional_properties = additional_properties
33
- @_field_set = { "condition": condition, "from": from, "to": to }.reject do |_k, v|
37
+ @_field_set = { "condition": condition, "from": from, "to": to, "metadata": metadata }.reject do |_k, v|
34
38
  v == OMIT
35
39
  end
36
40
  end
@@ -50,10 +54,12 @@ module Vapi
50
54
  end
51
55
  from = parsed_json["from"]
52
56
  to = parsed_json["to"]
57
+ metadata = parsed_json["metadata"]
53
58
  new(
54
59
  condition: condition,
55
60
  from: from,
56
61
  to: to,
62
+ metadata: metadata,
57
63
  additional_properties: struct
58
64
  )
59
65
  end
@@ -75,6 +81,7 @@ module Vapi
75
81
  obj.condition.nil? || Vapi::EdgeCondition.validate_raw(obj: obj.condition)
76
82
  obj.from.is_a?(String) != false || raise("Passed value for field obj.from is not the expected type, validation failed.")
77
83
  obj.to.is_a?(String) != false || raise("Passed value for field obj.to is not the expected type, validation failed.")
84
+ obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
78
85
  end
79
86
  end
80
87
  end