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,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "json"
4
- require_relative "semantic_edge_condition"
5
- require_relative "programmatic_edge_condition"
4
+ require_relative "ai_edge_condition"
5
+ require_relative "logic_edge_condition"
6
+ require_relative "failed_edge_condition"
6
7
 
7
8
  module Vapi
8
9
  class EdgeCondition
@@ -29,12 +30,14 @@ module Vapi
29
30
  def self.from_json(json_object:)
30
31
  struct = JSON.parse(json_object, object_class: OpenStruct)
31
32
  member = case struct.type
32
- when "semantic"
33
- Vapi::SemanticEdgeCondition.from_json(json_object: json_object)
34
- when "programmatic"
35
- Vapi::ProgrammaticEdgeCondition.from_json(json_object: json_object)
33
+ when "ai"
34
+ Vapi::AiEdgeCondition.from_json(json_object: json_object)
35
+ when "logic"
36
+ Vapi::LogicEdgeCondition.from_json(json_object: json_object)
37
+ when "failed"
38
+ Vapi::FailedEdgeCondition.from_json(json_object: json_object)
36
39
  else
37
- Vapi::SemanticEdgeCondition.from_json(json_object: json_object)
40
+ Vapi::AiEdgeCondition.from_json(json_object: json_object)
38
41
  end
39
42
  new(member: member, discriminant: struct.type)
40
43
  end
@@ -44,9 +47,11 @@ module Vapi
44
47
  # @return [String]
45
48
  def to_json(*_args)
46
49
  case @discriminant
47
- when "semantic"
50
+ when "ai"
48
51
  { **@member.to_json, type: @discriminant }.to_json
49
- when "programmatic"
52
+ when "logic"
53
+ { **@member.to_json, type: @discriminant }.to_json
54
+ when "failed"
50
55
  { **@member.to_json, type: @discriminant }.to_json
51
56
  else
52
57
  { "type": @discriminant, value: @member }.to_json
@@ -62,10 +67,12 @@ module Vapi
62
67
  # @return [Void]
63
68
  def self.validate_raw(obj:)
64
69
  case obj.type
65
- when "semantic"
66
- Vapi::SemanticEdgeCondition.validate_raw(obj: obj)
67
- when "programmatic"
68
- Vapi::ProgrammaticEdgeCondition.validate_raw(obj: obj)
70
+ when "ai"
71
+ Vapi::AiEdgeCondition.validate_raw(obj: obj)
72
+ when "logic"
73
+ Vapi::LogicEdgeCondition.validate_raw(obj: obj)
74
+ when "failed"
75
+ Vapi::FailedEdgeCondition.validate_raw(obj: obj)
69
76
  else
70
77
  raise("Passed value matched no type within the union, validation failed.")
71
78
  end
@@ -79,16 +86,22 @@ module Vapi
79
86
  @member.is_a?(obj)
80
87
  end
81
88
 
82
- # @param member [Vapi::SemanticEdgeCondition]
89
+ # @param member [Vapi::AiEdgeCondition]
90
+ # @return [Vapi::EdgeCondition]
91
+ def self.ai(member:)
92
+ new(member: member, discriminant: "ai")
93
+ end
94
+
95
+ # @param member [Vapi::LogicEdgeCondition]
83
96
  # @return [Vapi::EdgeCondition]
84
- def self.semantic(member:)
85
- new(member: member, discriminant: "semantic")
97
+ def self.logic(member:)
98
+ new(member: member, discriminant: "logic")
86
99
  end
87
100
 
88
- # @param member [Vapi::ProgrammaticEdgeCondition]
101
+ # @param member [Vapi::FailedEdgeCondition]
89
102
  # @return [Vapi::EdgeCondition]
90
- def self.programmatic(member:)
91
- new(member: member, discriminant: "programmatic")
103
+ def self.failed(member:)
104
+ new(member: member, discriminant: "failed")
92
105
  end
93
106
  end
94
107
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vapi
7
+ class FailedEdgeCondition
8
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
9
+ attr_reader :additional_properties
10
+ # @return [Object]
11
+ attr_reader :_field_set
12
+ protected :_field_set
13
+
14
+ OMIT = Object.new
15
+
16
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
17
+ # @return [Vapi::FailedEdgeCondition]
18
+ def initialize(additional_properties: nil)
19
+ @additional_properties = additional_properties
20
+ @_field_set = {}
21
+ end
22
+
23
+ # Deserialize a JSON object to an instance of FailedEdgeCondition
24
+ #
25
+ # @param json_object [String]
26
+ # @return [Vapi::FailedEdgeCondition]
27
+ def self.from_json(json_object:)
28
+ struct = JSON.parse(json_object, object_class: OpenStruct)
29
+ new(additional_properties: struct)
30
+ end
31
+
32
+ # Serialize an instance of FailedEdgeCondition to a JSON object
33
+ #
34
+ # @return [String]
35
+ def to_json(*_args)
36
+ @_field_set&.to_json
37
+ end
38
+
39
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
40
+ # hash and check each fields type against the current object's property
41
+ # definitions.
42
+ #
43
+ # @param obj [Object]
44
+ # @return [Void]
45
+ def self.validate_raw(obj:); end
46
+ end
47
+ end
@@ -2,20 +2,23 @@
2
2
 
3
3
  require_relative "fallback_cartesia_voice_model"
4
4
  require_relative "fallback_cartesia_voice_language"
5
+ require_relative "cartesia_experimental_controls"
5
6
  require_relative "chunk_plan"
6
7
  require "ostruct"
7
8
  require "json"
8
9
 
9
10
  module Vapi
10
11
  class FallbackCartesiaVoice
12
+ # @return [String] The ID of the particular voice you want to use.
13
+ attr_reader :voice_id
11
14
  # @return [Vapi::FallbackCartesiaVoiceModel] This is the model that will be used. This is optional and will default to the
12
15
  # correct model for the voiceId.
13
16
  attr_reader :model
14
17
  # @return [Vapi::FallbackCartesiaVoiceLanguage] This is the language that will be used. This is optional and will default to the
15
18
  # correct language for the voiceId.
16
19
  attr_reader :language
17
- # @return [String] This is the provider-specific ID that will be used.
18
- attr_reader :voice_id
20
+ # @return [Vapi::CartesiaExperimentalControls] Experimental controls for Cartesia voice generation
21
+ attr_reader :experimental_controls
19
22
  # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice
20
23
  # provider.
21
24
  attr_reader :chunk_plan
@@ -27,25 +30,29 @@ module Vapi
27
30
 
28
31
  OMIT = Object.new
29
32
 
33
+ # @param voice_id [String] The ID of the particular voice you want to use.
30
34
  # @param model [Vapi::FallbackCartesiaVoiceModel] This is the model that will be used. This is optional and will default to the
31
35
  # correct model for the voiceId.
32
36
  # @param language [Vapi::FallbackCartesiaVoiceLanguage] This is the language that will be used. This is optional and will default to the
33
37
  # correct language for the voiceId.
34
- # @param voice_id [String] This is the provider-specific ID that will be used.
38
+ # @param experimental_controls [Vapi::CartesiaExperimentalControls] Experimental controls for Cartesia voice generation
35
39
  # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice
36
40
  # provider.
37
41
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
38
42
  # @return [Vapi::FallbackCartesiaVoice]
39
- def initialize(voice_id:, model: OMIT, language: OMIT, chunk_plan: OMIT, additional_properties: nil)
43
+ def initialize(voice_id:, model: OMIT, language: OMIT, experimental_controls: OMIT, chunk_plan: OMIT,
44
+ additional_properties: nil)
45
+ @voice_id = voice_id
40
46
  @model = model if model != OMIT
41
47
  @language = language if language != OMIT
42
- @voice_id = voice_id
48
+ @experimental_controls = experimental_controls if experimental_controls != OMIT
43
49
  @chunk_plan = chunk_plan if chunk_plan != OMIT
44
50
  @additional_properties = additional_properties
45
51
  @_field_set = {
52
+ "voiceId": voice_id,
46
53
  "model": model,
47
54
  "language": language,
48
- "voiceId": voice_id,
55
+ "experimentalControls": experimental_controls,
49
56
  "chunkPlan": chunk_plan
50
57
  }.reject do |_k, v|
51
58
  v == OMIT
@@ -59,9 +66,15 @@ module Vapi
59
66
  def self.from_json(json_object:)
60
67
  struct = JSON.parse(json_object, object_class: OpenStruct)
61
68
  parsed_json = JSON.parse(json_object)
69
+ voice_id = parsed_json["voiceId"]
62
70
  model = parsed_json["model"]
63
71
  language = parsed_json["language"]
64
- voice_id = parsed_json["voiceId"]
72
+ if parsed_json["experimentalControls"].nil?
73
+ experimental_controls = nil
74
+ else
75
+ experimental_controls = parsed_json["experimentalControls"].to_json
76
+ experimental_controls = Vapi::CartesiaExperimentalControls.from_json(json_object: experimental_controls)
77
+ end
65
78
  if parsed_json["chunkPlan"].nil?
66
79
  chunk_plan = nil
67
80
  else
@@ -69,9 +82,10 @@ module Vapi
69
82
  chunk_plan = Vapi::ChunkPlan.from_json(json_object: chunk_plan)
70
83
  end
71
84
  new(
85
+ voice_id: voice_id,
72
86
  model: model,
73
87
  language: language,
74
- voice_id: voice_id,
88
+ experimental_controls: experimental_controls,
75
89
  chunk_plan: chunk_plan,
76
90
  additional_properties: struct
77
91
  )
@@ -91,9 +105,10 @@ module Vapi
91
105
  # @param obj [Object]
92
106
  # @return [Void]
93
107
  def self.validate_raw(obj:)
108
+ obj.voice_id.is_a?(String) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.")
94
109
  obj.model&.is_a?(Vapi::FallbackCartesiaVoiceModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.")
95
110
  obj.language&.is_a?(Vapi::FallbackCartesiaVoiceLanguage) != false || raise("Passed value for field obj.language is not the expected type, validation failed.")
96
- obj.voice_id.is_a?(String) != false || raise("Passed value for field obj.voice_id is not the expected type, validation failed.")
111
+ obj.experimental_controls.nil? || Vapi::CartesiaExperimentalControls.validate_raw(obj: obj.experimental_controls)
97
112
  obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan)
98
113
  end
99
114
  end
@@ -9,6 +9,12 @@ module Vapi
9
9
  class FallbackDeepgramVoice
10
10
  # @return [Vapi::FallbackDeepgramVoiceId] This is the provider-specific ID that will be used.
11
11
  attr_reader :voice_id
12
+ # @return [Boolean] If set to true, this will add mip_opt_out=true as a query parameter of all API
13
+ # requests. See
14
+ # gram.com/docs/the-deepgram-model-improvement-partnership-program#want-to-opt-out
15
+ # This will only be used if you are using your own Deepgram API key.
16
+ # @default false
17
+ attr_reader :mip_opt_out
12
18
  # @return [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice
13
19
  # provider.
14
20
  attr_reader :chunk_plan
@@ -21,15 +27,21 @@ module Vapi
21
27
  OMIT = Object.new
22
28
 
23
29
  # @param voice_id [Vapi::FallbackDeepgramVoiceId] This is the provider-specific ID that will be used.
30
+ # @param mip_opt_out [Boolean] If set to true, this will add mip_opt_out=true as a query parameter of all API
31
+ # requests. See
32
+ # gram.com/docs/the-deepgram-model-improvement-partnership-program#want-to-opt-out
33
+ # This will only be used if you are using your own Deepgram API key.
34
+ # @default false
24
35
  # @param chunk_plan [Vapi::ChunkPlan] This is the plan for chunking the model output before it is sent to the voice
25
36
  # provider.
26
37
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
27
38
  # @return [Vapi::FallbackDeepgramVoice]
28
- def initialize(voice_id:, chunk_plan: OMIT, additional_properties: nil)
39
+ def initialize(voice_id:, mip_opt_out: OMIT, chunk_plan: OMIT, additional_properties: nil)
29
40
  @voice_id = voice_id
41
+ @mip_opt_out = mip_opt_out if mip_opt_out != OMIT
30
42
  @chunk_plan = chunk_plan if chunk_plan != OMIT
31
43
  @additional_properties = additional_properties
32
- @_field_set = { "voiceId": voice_id, "chunkPlan": chunk_plan }.reject do |_k, v|
44
+ @_field_set = { "voiceId": voice_id, "mipOptOut": mip_opt_out, "chunkPlan": chunk_plan }.reject do |_k, v|
33
45
  v == OMIT
34
46
  end
35
47
  end
@@ -47,6 +59,7 @@ module Vapi
47
59
  voice_id = parsed_json["voiceId"].to_json
48
60
  voice_id = Vapi::FallbackDeepgramVoiceId.from_json(json_object: voice_id)
49
61
  end
62
+ mip_opt_out = parsed_json["mipOptOut"]
50
63
  if parsed_json["chunkPlan"].nil?
51
64
  chunk_plan = nil
52
65
  else
@@ -55,6 +68,7 @@ module Vapi
55
68
  end
56
69
  new(
57
70
  voice_id: voice_id,
71
+ mip_opt_out: mip_opt_out,
58
72
  chunk_plan: chunk_plan,
59
73
  additional_properties: struct
60
74
  )
@@ -75,6 +89,7 @@ module Vapi
75
89
  # @return [Void]
76
90
  def self.validate_raw(obj:)
77
91
  Vapi::FallbackDeepgramVoiceId.validate_raw(obj: obj.voice_id)
92
+ obj.mip_opt_out&.is_a?(Boolean) != false || raise("Passed value for field obj.mip_opt_out is not the expected type, validation failed.")
78
93
  obj.chunk_plan.nil? || Vapi::ChunkPlan.validate_raw(obj: obj.chunk_plan)
79
94
  end
80
95
  end
@@ -6,5 +6,6 @@ module Vapi
6
6
  PLAY_HT_20 = "PlayHT2.0"
7
7
  PLAY_HT_20_TURBO = "PlayHT2.0-turbo"
8
8
  PLAY_30_MINI = "Play3.0-mini"
9
+ PLAY_DIALOG = "PlayDialog"
9
10
  end
10
11
  end
@@ -2,26 +2,6 @@
2
2
 
3
3
  module Vapi
4
4
  class FallbackRimeAiVoiceIdEnum
5
- MARSH = "marsh"
6
- BAYOU = "bayou"
7
- CREEK = "creek"
8
- BROOK = "brook"
9
- FLOWER = "flower"
10
- SPORE = "spore"
11
- GLACIER = "glacier"
12
- GULCH = "gulch"
13
- ALPINE = "alpine"
14
- COVE = "cove"
15
- LAGOON = "lagoon"
16
- TUNDRA = "tundra"
17
- STEPPE = "steppe"
18
- MESA = "mesa"
19
- GROVE = "grove"
20
- RAINFOREST = "rainforest"
21
- MORAINE = "moraine"
22
- WILDFLOWER = "wildflower"
23
- PEAK = "peak"
24
- BOULDER = "boulder"
25
5
  ABBIE = "abbie"
26
6
  ALLISON = "allison"
27
7
  ALLY = "ally"
@@ -83,5 +63,27 @@ module Vapi
83
63
  TYLER = "tyler"
84
64
  VIV = "viv"
85
65
  YADIRA = "yadira"
66
+ MARSH = "marsh"
67
+ BAYOU = "bayou"
68
+ CREEK = "creek"
69
+ BROOK = "brook"
70
+ FLOWER = "flower"
71
+ SPORE = "spore"
72
+ GLACIER = "glacier"
73
+ GULCH = "gulch"
74
+ ALPINE = "alpine"
75
+ COVE = "cove"
76
+ LAGOON = "lagoon"
77
+ TUNDRA = "tundra"
78
+ STEPPE = "steppe"
79
+ MESA = "mesa"
80
+ GROVE = "grove"
81
+ RAINFOREST = "rainforest"
82
+ MORAINE = "moraine"
83
+ WILDFLOWER = "wildflower"
84
+ PEAK = "peak"
85
+ BOULDER = "boulder"
86
+ GYPSUM = "gypsum"
87
+ ZEST = "zest"
86
88
  end
87
89
  end
@@ -5,5 +5,6 @@ module Vapi
5
5
  class FallbackRimeAiVoiceModel
6
6
  V_1 = "v1"
7
7
  MIST = "mist"
8
+ MISTV_2 = "mistv2"
8
9
  end
9
10
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "format_plan_replacements_item"
4
+ require_relative "format_plan_formatters_enabled_item"
4
5
  require "ostruct"
5
6
  require "json"
6
7
 
@@ -35,6 +36,13 @@ module Vapi
35
36
  # type. Eg. `{ type: 'regex', regex: '\\b[a-zA-Z]{5}\\b', value: 'hi' }`
36
37
  # @default []
37
38
  attr_reader :replacements
39
+ # @return [Array<Vapi::FormatPlanFormattersEnabledItem>] List of formatters to apply. If not provided, all default formatters will be
40
+ # applied.
41
+ # If provided, only the specified formatters will be applied.
42
+ # Note: Some essential formatters like angle bracket removal will always be
43
+ # applied.
44
+ # @default undefined
45
+ attr_reader :formatters_enabled
38
46
  # @return [OpenStruct] Additional properties unmapped to the current class definition
39
47
  attr_reader :additional_properties
40
48
  # @return [Object]
@@ -69,17 +77,26 @@ module Vapi
69
77
  # - To replace a word or phrase that matches a pattern, use the `RegexReplacement`
70
78
  # type. Eg. `{ type: 'regex', regex: '\\b[a-zA-Z]{5}\\b', value: 'hi' }`
71
79
  # @default []
80
+ # @param formatters_enabled [Array<Vapi::FormatPlanFormattersEnabledItem>] List of formatters to apply. If not provided, all default formatters will be
81
+ # applied.
82
+ # If provided, only the specified formatters will be applied.
83
+ # Note: Some essential formatters like angle bracket removal will always be
84
+ # applied.
85
+ # @default undefined
72
86
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
73
87
  # @return [Vapi::FormatPlan]
74
- def initialize(enabled: OMIT, number_to_digits_cutoff: OMIT, replacements: OMIT, additional_properties: nil)
88
+ def initialize(enabled: OMIT, number_to_digits_cutoff: OMIT, replacements: OMIT, formatters_enabled: OMIT,
89
+ additional_properties: nil)
75
90
  @enabled = enabled if enabled != OMIT
76
91
  @number_to_digits_cutoff = number_to_digits_cutoff if number_to_digits_cutoff != OMIT
77
92
  @replacements = replacements if replacements != OMIT
93
+ @formatters_enabled = formatters_enabled if formatters_enabled != OMIT
78
94
  @additional_properties = additional_properties
79
95
  @_field_set = {
80
96
  "enabled": enabled,
81
97
  "numberToDigitsCutoff": number_to_digits_cutoff,
82
- "replacements": replacements
98
+ "replacements": replacements,
99
+ "formattersEnabled": formatters_enabled
83
100
  }.reject do |_k, v|
84
101
  v == OMIT
85
102
  end
@@ -98,10 +115,12 @@ module Vapi
98
115
  item = item.to_json
99
116
  Vapi::FormatPlanReplacementsItem.from_json(json_object: item)
100
117
  end
118
+ formatters_enabled = parsed_json["formattersEnabled"]
101
119
  new(
102
120
  enabled: enabled,
103
121
  number_to_digits_cutoff: number_to_digits_cutoff,
104
122
  replacements: replacements,
123
+ formatters_enabled: formatters_enabled,
105
124
  additional_properties: struct
106
125
  )
107
126
  end
@@ -123,6 +142,7 @@ module Vapi
123
142
  obj.enabled&.is_a?(Boolean) != false || raise("Passed value for field obj.enabled is not the expected type, validation failed.")
124
143
  obj.number_to_digits_cutoff&.is_a?(Float) != false || raise("Passed value for field obj.number_to_digits_cutoff is not the expected type, validation failed.")
125
144
  obj.replacements&.is_a?(Array) != false || raise("Passed value for field obj.replacements is not the expected type, validation failed.")
145
+ obj.formatters_enabled&.is_a?(Array) != false || raise("Passed value for field obj.formatters_enabled is not the expected type, validation failed.")
126
146
  end
127
147
  end
128
148
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vapi
4
+ class FormatPlanFormattersEnabledItem
5
+ MARKDOWN = "markdown"
6
+ ASTERISK = "asterisk"
7
+ QUOTE = "quote"
8
+ DASH = "dash"
9
+ NEWLINE = "newline"
10
+ COLON = "colon"
11
+ ACRONYM = "acronym"
12
+ DOLLAR_AMOUNT = "dollarAmount"
13
+ EMAIL = "email"
14
+ DATE = "date"
15
+ TIME = "time"
16
+ DISTANCE = "distance"
17
+ UNIT = "unit"
18
+ PERCENTAGE = "percentage"
19
+ PHONE_NUMBER = "phoneNumber"
20
+ NUMBER = "number"
21
+ end
22
+ end
@@ -1,19 +1,37 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "json_schema"
4
+ require_relative "hook"
4
5
  require "ostruct"
5
6
  require "json"
6
7
 
7
8
  module Vapi
8
9
  class Gather
9
- # @return [String]
10
- attr_reader :type
11
10
  # @return [Vapi::JsonSchema]
12
- attr_reader :schema
13
- # @return [String]
14
- attr_reader :instruction
11
+ attr_reader :output
12
+ # @return [Boolean] This is whether or not the workflow should read back the gathered data to the
13
+ # user, and ask about its correctness.
14
+ attr_reader :confirm_content
15
+ # @return [Array<Vapi::Hook>] This is a list of hooks for a task.
16
+ # Each hook is a list of tasks to run on a trigger (such as on start, on failure,
17
+ # etc).
18
+ # Only Say is supported for now.
19
+ attr_reader :hooks
20
+ # @return [Float] This is the number of times we should try to gather the information from the
21
+ # user before we failover to the fail path. An example of this would be a user
22
+ # refusing to give their phone number for privacy reasons, and then going down a
23
+ # different path on account of this
24
+ attr_reader :max_retries
25
+ # @return [String] This is a liquid templating string. On the first call to Gather, the template
26
+ # will be filled out with variables from the context, and will be spoken verbatim
27
+ # to the user. An example would be "Base on your zipcode, it looks like you could
28
+ # be in one of these counties: {{ counties | join: ", " }}. Which one do you live
29
+ # in?"
30
+ attr_reader :literal_template
15
31
  # @return [String]
16
32
  attr_reader :name
33
+ # @return [Hash{String => Object}] This is for metadata you want to store on the task.
34
+ attr_reader :metadata
17
35
  # @return [OpenStruct] Additional properties unmapped to the current class definition
18
36
  attr_reader :additional_properties
19
37
  # @return [Object]
@@ -22,19 +40,45 @@ module Vapi
22
40
 
23
41
  OMIT = Object.new
24
42
 
25
- # @param type [String]
26
- # @param schema [Vapi::JsonSchema]
27
- # @param instruction [String]
43
+ # @param output [Vapi::JsonSchema]
44
+ # @param confirm_content [Boolean] This is whether or not the workflow should read back the gathered data to the
45
+ # user, and ask about its correctness.
46
+ # @param hooks [Array<Vapi::Hook>] This is a list of hooks for a task.
47
+ # Each hook is a list of tasks to run on a trigger (such as on start, on failure,
48
+ # etc).
49
+ # Only Say is supported for now.
50
+ # @param max_retries [Float] This is the number of times we should try to gather the information from the
51
+ # user before we failover to the fail path. An example of this would be a user
52
+ # refusing to give their phone number for privacy reasons, and then going down a
53
+ # different path on account of this
54
+ # @param literal_template [String] This is a liquid templating string. On the first call to Gather, the template
55
+ # will be filled out with variables from the context, and will be spoken verbatim
56
+ # to the user. An example would be "Base on your zipcode, it looks like you could
57
+ # be in one of these counties: {{ counties | join: ", " }}. Which one do you live
58
+ # in?"
28
59
  # @param name [String]
60
+ # @param metadata [Hash{String => Object}] This is for metadata you want to store on the task.
29
61
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
30
62
  # @return [Vapi::Gather]
31
- def initialize(type:, instruction:, name:, schema: OMIT, additional_properties: nil)
32
- @type = type
33
- @schema = schema if schema != OMIT
34
- @instruction = instruction
63
+ def initialize(output:, name:, confirm_content: OMIT, hooks: OMIT, max_retries: OMIT, literal_template: OMIT,
64
+ metadata: OMIT, additional_properties: nil)
65
+ @output = output
66
+ @confirm_content = confirm_content if confirm_content != OMIT
67
+ @hooks = hooks if hooks != OMIT
68
+ @max_retries = max_retries if max_retries != OMIT
69
+ @literal_template = literal_template if literal_template != OMIT
35
70
  @name = name
71
+ @metadata = metadata if metadata != OMIT
36
72
  @additional_properties = additional_properties
37
- @_field_set = { "type": type, "schema": schema, "instruction": instruction, "name": name }.reject do |_k, v|
73
+ @_field_set = {
74
+ "output": output,
75
+ "confirmContent": confirm_content,
76
+ "hooks": hooks,
77
+ "maxRetries": max_retries,
78
+ "literalTemplate": literal_template,
79
+ "name": name,
80
+ "metadata": metadata
81
+ }.reject do |_k, v|
38
82
  v == OMIT
39
83
  end
40
84
  end
@@ -46,20 +90,29 @@ module Vapi
46
90
  def self.from_json(json_object:)
47
91
  struct = JSON.parse(json_object, object_class: OpenStruct)
48
92
  parsed_json = JSON.parse(json_object)
49
- type = parsed_json["type"]
50
- if parsed_json["schema"].nil?
51
- schema = nil
93
+ if parsed_json["output"].nil?
94
+ output = nil
52
95
  else
53
- schema = parsed_json["schema"].to_json
54
- schema = Vapi::JsonSchema.from_json(json_object: schema)
96
+ output = parsed_json["output"].to_json
97
+ output = Vapi::JsonSchema.from_json(json_object: output)
98
+ end
99
+ confirm_content = parsed_json["confirmContent"]
100
+ hooks = parsed_json["hooks"]&.map do |item|
101
+ item = item.to_json
102
+ Vapi::Hook.from_json(json_object: item)
55
103
  end
56
- instruction = parsed_json["instruction"]
104
+ max_retries = parsed_json["maxRetries"]
105
+ literal_template = parsed_json["literalTemplate"]
57
106
  name = parsed_json["name"]
107
+ metadata = parsed_json["metadata"]
58
108
  new(
59
- type: type,
60
- schema: schema,
61
- instruction: instruction,
109
+ output: output,
110
+ confirm_content: confirm_content,
111
+ hooks: hooks,
112
+ max_retries: max_retries,
113
+ literal_template: literal_template,
62
114
  name: name,
115
+ metadata: metadata,
63
116
  additional_properties: struct
64
117
  )
65
118
  end
@@ -78,10 +131,13 @@ module Vapi
78
131
  # @param obj [Object]
79
132
  # @return [Void]
80
133
  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
- obj.schema.nil? || Vapi::JsonSchema.validate_raw(obj: obj.schema)
83
- obj.instruction.is_a?(String) != false || raise("Passed value for field obj.instruction is not the expected type, validation failed.")
134
+ Vapi::JsonSchema.validate_raw(obj: obj.output)
135
+ obj.confirm_content&.is_a?(Boolean) != false || raise("Passed value for field obj.confirm_content is not the expected type, validation failed.")
136
+ obj.hooks&.is_a?(Array) != false || raise("Passed value for field obj.hooks is not the expected type, validation failed.")
137
+ obj.max_retries&.is_a?(Float) != false || raise("Passed value for field obj.max_retries is not the expected type, validation failed.")
138
+ obj.literal_template&.is_a?(String) != false || raise("Passed value for field obj.literal_template is not the expected type, validation failed.")
84
139
  obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
140
+ obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
85
141
  end
86
142
  end
87
143
  end
@@ -3,6 +3,10 @@
3
3
  module Vapi
4
4
  # This is the Google model that will be used.
5
5
  class GoogleModelModel
6
+ GEMINI_20_FLASH_THINKING_EXP = "gemini-2.0-flash-thinking-exp"
7
+ GEMINI_20_PRO_EXP_0205 = "gemini-2.0-pro-exp-02-05"
8
+ GEMINI_20_FLASH = "gemini-2.0-flash"
9
+ GEMINI_20_FLASH_LITE_PREVIEW_0205 = "gemini-2.0-flash-lite-preview-02-05"
6
10
  GEMINI_20_FLASH_EXP = "gemini-2.0-flash-exp"
7
11
  GEMINI_20_FLASH_REALTIME_EXP = "gemini-2.0-flash-realtime-exp"
8
12
  GEMINI_15_FLASH = "gemini-1.5-flash"
@@ -3,6 +3,7 @@
3
3
  module Vapi
4
4
  # This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b
5
5
  class GroqModelModel
6
+ DEEPSEEK_R_1_DISTILL_LLAMA_70_B = "deepseek-r1-distill-llama-70b"
6
7
  LLAMA_3370_B_VERSATILE = "llama-3.3-70b-versatile"
7
8
  LLAMA_31405_B_REASONING = "llama-3.1-405b-reasoning"
8
9
  LLAMA_3170_B_VERSATILE = "llama-3.1-70b-versatile"