vapi_server_sdk 0.3.0 → 0.4.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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/requests.rb +2 -2
  3. data/lib/types_export.rb +31 -6
  4. data/lib/vapi_server_sdk/analytics/client.rb +0 -14
  5. data/lib/vapi_server_sdk/assistants/client.rb +4 -70
  6. data/lib/vapi_server_sdk/blocks/client.rb +0 -70
  7. data/lib/vapi_server_sdk/calls/client.rb +6 -70
  8. data/lib/vapi_server_sdk/files/client.rb +0 -70
  9. data/lib/vapi_server_sdk/knowledge_bases/client.rb +0 -70
  10. data/lib/vapi_server_sdk/logs/client.rb +13 -44
  11. data/lib/vapi_server_sdk/logs/types/logging_controller_logs_delete_query_request_type.rb +12 -0
  12. data/lib/vapi_server_sdk/phone_numbers/client.rb +0 -70
  13. data/lib/vapi_server_sdk/squads/client.rb +8 -70
  14. data/lib/vapi_server_sdk/tools/client.rb +0 -70
  15. data/lib/vapi_server_sdk/types/azure_credential_region.rb +4 -2
  16. data/lib/vapi_server_sdk/types/azure_open_ai_credential_region.rb +4 -2
  17. data/lib/vapi_server_sdk/types/bash_tool_with_tool_call.rb +175 -0
  18. data/lib/vapi_server_sdk/types/bash_tool_with_tool_call_messages_item.rb +120 -0
  19. data/lib/vapi_server_sdk/types/client_inbound_message_end_call.rb +47 -0
  20. data/lib/vapi_server_sdk/types/client_inbound_message_message.rb +13 -0
  21. data/lib/vapi_server_sdk/types/client_message_tool_calls_tool_with_tool_call_list_item.rb +116 -77
  22. data/lib/vapi_server_sdk/types/computer_tool_with_tool_call.rb +199 -0
  23. data/lib/vapi_server_sdk/types/computer_tool_with_tool_call_messages_item.rb +120 -0
  24. data/lib/vapi_server_sdk/types/create_azure_credential_dto_region.rb +4 -2
  25. data/lib/vapi_server_sdk/types/create_azure_open_ai_credential_dto_region.rb +4 -2
  26. data/lib/vapi_server_sdk/types/create_custom_knowledge_base_dto.rb +2 -4
  27. data/lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto.rb +34 -47
  28. data/lib/vapi_server_sdk/types/create_trieve_knowledge_base_dto_create_plan.rb +97 -0
  29. data/lib/vapi_server_sdk/types/create_workflow_dto.rb +87 -0
  30. data/lib/vapi_server_sdk/types/create_workflow_dto_nodes_item.rb +81 -0
  31. data/lib/vapi_server_sdk/types/custom_knowledge_base.rb +2 -4
  32. data/lib/vapi_server_sdk/types/edge.rb +80 -0
  33. data/lib/vapi_server_sdk/types/edge_condition.rb +94 -0
  34. data/lib/vapi_server_sdk/types/function_tool_with_tool_call.rb +1 -10
  35. data/lib/vapi_server_sdk/types/gather.rb +87 -0
  36. data/lib/vapi_server_sdk/types/ghl_tool_with_tool_call.rb +1 -9
  37. data/lib/vapi_server_sdk/types/json_schema.rb +13 -2
  38. data/lib/vapi_server_sdk/types/log.rb +18 -18
  39. data/lib/vapi_server_sdk/types/make_tool_with_tool_call.rb +1 -9
  40. data/lib/vapi_server_sdk/types/programmatic_edge_condition.rb +57 -0
  41. data/lib/vapi_server_sdk/types/say.rb +72 -0
  42. data/lib/vapi_server_sdk/types/semantic_edge_condition.rb +57 -0
  43. data/lib/vapi_server_sdk/types/server_message_tool_calls_tool_with_tool_call_list_item.rb +116 -77
  44. data/lib/vapi_server_sdk/types/subscription.rb +11 -9
  45. data/lib/vapi_server_sdk/types/text_editor_tool_with_tool_call.rb +175 -0
  46. data/lib/vapi_server_sdk/types/text_editor_tool_with_tool_call_messages_item.rb +121 -0
  47. data/lib/vapi_server_sdk/types/trieve_knowledge_base.rb +35 -44
  48. data/lib/vapi_server_sdk/types/{trieve_knowledge_base_vector_store_create_plan.rb → trieve_knowledge_base_chunk_plan.rb} +17 -11
  49. data/lib/vapi_server_sdk/types/trieve_knowledge_base_create.rb +59 -0
  50. data/lib/vapi_server_sdk/types/trieve_knowledge_base_create_plan.rb +96 -0
  51. data/lib/vapi_server_sdk/types/trieve_knowledge_base_import.rb +55 -0
  52. data/lib/vapi_server_sdk/types/{trieve_knowledge_base_vector_store_search_plan.rb → trieve_knowledge_base_search_plan.rb} +9 -11
  53. data/lib/vapi_server_sdk/types/{trieve_knowledge_base_vector_store_search_plan_search_type.rb → trieve_knowledge_base_search_plan_search_type.rb} +1 -1
  54. data/lib/vapi_server_sdk/types/update_azure_credential_dto_region.rb +4 -2
  55. data/lib/vapi_server_sdk/types/update_azure_open_ai_credential_dto_region.rb +4 -2
  56. data/lib/vapi_server_sdk/types/update_custom_knowledge_base_dto.rb +2 -4
  57. data/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto.rb +34 -47
  58. data/lib/vapi_server_sdk/types/update_trieve_knowledge_base_dto_create_plan.rb +97 -0
  59. data/lib/vapi_server_sdk/types/update_workflow_dto.rb +82 -0
  60. data/lib/vapi_server_sdk/types/update_workflow_dto_nodes_item.rb +81 -0
  61. data/lib/vapi_server_sdk/types/vapi_model.rb +27 -1
  62. data/lib/vapi_server_sdk/types/workflow.rb +125 -0
  63. data/lib/vapi_server_sdk/types/workflow_nodes_item.rb +81 -0
  64. metadata +30 -5
@@ -35,13 +35,6 @@ module Vapi
35
35
  # specified value.
36
36
  # @param request_options [Vapi::RequestOptions]
37
37
  # @return [Array<Vapi::Squad>]
38
- # @example
39
- # api = Vapi::Client.new(
40
- # base_url: "https://api.example.com",
41
- # environment: Vapi::Environment::DEFAULT,
42
- # token: "YOUR_AUTH_TOKEN"
43
- # )
44
- # api.squads.list
45
38
  def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil,
46
39
  updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil)
47
40
  response = @request_client.conn.get do |req|
@@ -123,6 +116,7 @@ module Vapi
123
116
  # * :properties (Hash{String => Object})
124
117
  # * :description (String)
125
118
  # * :required (Array<String>)
119
+ # * :enum (Array<String>)
126
120
  # * :timeout_seconds (Float)
127
121
  # * :success_evaluation_plan (Hash)
128
122
  # * :rubric (Vapi::SuccessEvaluationPlanRubric)
@@ -164,13 +158,6 @@ module Vapi
164
158
  # * :headers (Hash{String => Object})
165
159
  # @param request_options [Vapi::RequestOptions]
166
160
  # @return [Vapi::Squad]
167
- # @example
168
- # api = Vapi::Client.new(
169
- # base_url: "https://api.example.com",
170
- # environment: Vapi::Environment::DEFAULT,
171
- # token: "YOUR_AUTH_TOKEN"
172
- # )
173
- # api.squads.create(request: { members: [{ }] })
174
161
  def create(request:, request_options: nil)
175
162
  response = @request_client.conn.post do |req|
176
163
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -192,13 +179,6 @@ module Vapi
192
179
  # @param id [String]
193
180
  # @param request_options [Vapi::RequestOptions]
194
181
  # @return [Vapi::Squad]
195
- # @example
196
- # api = Vapi::Client.new(
197
- # base_url: "https://api.example.com",
198
- # environment: Vapi::Environment::DEFAULT,
199
- # token: "YOUR_AUTH_TOKEN"
200
- # )
201
- # api.squads.get(id: "id")
202
182
  def get(id:, request_options: nil)
203
183
  response = @request_client.conn.get do |req|
204
184
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -222,13 +202,6 @@ module Vapi
222
202
  # @param id [String]
223
203
  # @param request_options [Vapi::RequestOptions]
224
204
  # @return [Vapi::Squad]
225
- # @example
226
- # api = Vapi::Client.new(
227
- # base_url: "https://api.example.com",
228
- # environment: Vapi::Environment::DEFAULT,
229
- # token: "YOUR_AUTH_TOKEN"
230
- # )
231
- # api.squads.delete(id: "id")
232
205
  def delete(id:, request_options: nil)
233
206
  response = @request_client.conn.delete do |req|
234
207
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -297,6 +270,7 @@ module Vapi
297
270
  # * :properties (Hash{String => Object})
298
271
  # * :description (String)
299
272
  # * :required (Array<String>)
273
+ # * :enum (Array<String>)
300
274
  # * :timeout_seconds (Float)
301
275
  # * :success_evaluation_plan (Hash)
302
276
  # * :rubric (Vapi::SuccessEvaluationPlanRubric)
@@ -380,6 +354,7 @@ module Vapi
380
354
  # * :properties (Hash{String => Object})
381
355
  # * :description (String)
382
356
  # * :required (Array<String>)
357
+ # * :enum (Array<String>)
383
358
  # * :timeout_seconds (Float)
384
359
  # * :success_evaluation_plan (Hash)
385
360
  # * :rubric (Vapi::SuccessEvaluationPlanRubric)
@@ -468,6 +443,7 @@ module Vapi
468
443
  # * :properties (Hash{String => Object})
469
444
  # * :description (String)
470
445
  # * :required (Array<String>)
446
+ # * :enum (Array<String>)
471
447
  # * :timeout_seconds (Float)
472
448
  # * :success_evaluation_plan (Hash)
473
449
  # * :rubric (Vapi::SuccessEvaluationPlanRubric)
@@ -509,13 +485,6 @@ module Vapi
509
485
  # * :headers (Hash{String => Object})
510
486
  # @param request_options [Vapi::RequestOptions]
511
487
  # @return [Vapi::Squad]
512
- # @example
513
- # api = Vapi::Client.new(
514
- # base_url: "https://api.example.com",
515
- # environment: Vapi::Environment::DEFAULT,
516
- # token: "YOUR_AUTH_TOKEN"
517
- # )
518
- # api.squads.update(id: "id", members: [{ }])
519
488
  def update(id:, members:, name: nil, members_overrides: nil, request_options: nil)
520
489
  response = @request_client.conn.patch do |req|
521
490
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -565,13 +534,6 @@ module Vapi
565
534
  # specified value.
566
535
  # @param request_options [Vapi::RequestOptions]
567
536
  # @return [Array<Vapi::Squad>]
568
- # @example
569
- # api = Vapi::Client.new(
570
- # base_url: "https://api.example.com",
571
- # environment: Vapi::Environment::DEFAULT,
572
- # token: "YOUR_AUTH_TOKEN"
573
- # )
574
- # api.squads.list
575
537
  def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil,
576
538
  updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil)
577
539
  Async do
@@ -655,6 +617,7 @@ module Vapi
655
617
  # * :properties (Hash{String => Object})
656
618
  # * :description (String)
657
619
  # * :required (Array<String>)
620
+ # * :enum (Array<String>)
658
621
  # * :timeout_seconds (Float)
659
622
  # * :success_evaluation_plan (Hash)
660
623
  # * :rubric (Vapi::SuccessEvaluationPlanRubric)
@@ -696,13 +659,6 @@ module Vapi
696
659
  # * :headers (Hash{String => Object})
697
660
  # @param request_options [Vapi::RequestOptions]
698
661
  # @return [Vapi::Squad]
699
- # @example
700
- # api = Vapi::Client.new(
701
- # base_url: "https://api.example.com",
702
- # environment: Vapi::Environment::DEFAULT,
703
- # token: "YOUR_AUTH_TOKEN"
704
- # )
705
- # api.squads.create(request: { members: [{ }] })
706
662
  def create(request:, request_options: nil)
707
663
  Async do
708
664
  response = @request_client.conn.post do |req|
@@ -726,13 +682,6 @@ module Vapi
726
682
  # @param id [String]
727
683
  # @param request_options [Vapi::RequestOptions]
728
684
  # @return [Vapi::Squad]
729
- # @example
730
- # api = Vapi::Client.new(
731
- # base_url: "https://api.example.com",
732
- # environment: Vapi::Environment::DEFAULT,
733
- # token: "YOUR_AUTH_TOKEN"
734
- # )
735
- # api.squads.get(id: "id")
736
685
  def get(id:, request_options: nil)
737
686
  Async do
738
687
  response = @request_client.conn.get do |req|
@@ -758,13 +707,6 @@ module Vapi
758
707
  # @param id [String]
759
708
  # @param request_options [Vapi::RequestOptions]
760
709
  # @return [Vapi::Squad]
761
- # @example
762
- # api = Vapi::Client.new(
763
- # base_url: "https://api.example.com",
764
- # environment: Vapi::Environment::DEFAULT,
765
- # token: "YOUR_AUTH_TOKEN"
766
- # )
767
- # api.squads.delete(id: "id")
768
710
  def delete(id:, request_options: nil)
769
711
  Async do
770
712
  response = @request_client.conn.delete do |req|
@@ -835,6 +777,7 @@ module Vapi
835
777
  # * :properties (Hash{String => Object})
836
778
  # * :description (String)
837
779
  # * :required (Array<String>)
780
+ # * :enum (Array<String>)
838
781
  # * :timeout_seconds (Float)
839
782
  # * :success_evaluation_plan (Hash)
840
783
  # * :rubric (Vapi::SuccessEvaluationPlanRubric)
@@ -918,6 +861,7 @@ module Vapi
918
861
  # * :properties (Hash{String => Object})
919
862
  # * :description (String)
920
863
  # * :required (Array<String>)
864
+ # * :enum (Array<String>)
921
865
  # * :timeout_seconds (Float)
922
866
  # * :success_evaluation_plan (Hash)
923
867
  # * :rubric (Vapi::SuccessEvaluationPlanRubric)
@@ -1006,6 +950,7 @@ module Vapi
1006
950
  # * :properties (Hash{String => Object})
1007
951
  # * :description (String)
1008
952
  # * :required (Array<String>)
953
+ # * :enum (Array<String>)
1009
954
  # * :timeout_seconds (Float)
1010
955
  # * :success_evaluation_plan (Hash)
1011
956
  # * :rubric (Vapi::SuccessEvaluationPlanRubric)
@@ -1047,13 +992,6 @@ module Vapi
1047
992
  # * :headers (Hash{String => Object})
1048
993
  # @param request_options [Vapi::RequestOptions]
1049
994
  # @return [Vapi::Squad]
1050
- # @example
1051
- # api = Vapi::Client.new(
1052
- # base_url: "https://api.example.com",
1053
- # environment: Vapi::Environment::DEFAULT,
1054
- # token: "YOUR_AUTH_TOKEN"
1055
- # )
1056
- # api.squads.update(id: "id", members: [{ }])
1057
995
  def update(id:, members:, name: nil, members_overrides: nil, request_options: nil)
1058
996
  Async do
1059
997
  response = @request_client.conn.patch do |req|
@@ -38,13 +38,6 @@ module Vapi
38
38
  # specified value.
39
39
  # @param request_options [Vapi::RequestOptions]
40
40
  # @return [Array<Vapi::Tools::ToolsListResponseItem>]
41
- # @example
42
- # api = Vapi::Client.new(
43
- # base_url: "https://api.example.com",
44
- # environment: Vapi::Environment::DEFAULT,
45
- # token: "YOUR_AUTH_TOKEN"
46
- # )
47
- # api.tools.list
48
41
  def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil,
49
42
  updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil)
50
43
  response = @request_client.conn.get do |req|
@@ -82,13 +75,6 @@ module Vapi
82
75
  # @param request [Vapi::Tools::ToolsCreateRequest]
83
76
  # @param request_options [Vapi::RequestOptions]
84
77
  # @return [Vapi::Tools::ToolsCreateResponse]
85
- # @example
86
- # api = Vapi::Client.new(
87
- # base_url: "https://api.example.com",
88
- # environment: Vapi::Environment::DEFAULT,
89
- # token: "YOUR_AUTH_TOKEN"
90
- # )
91
- # api.tools.create
92
78
  def create(request:, request_options: nil)
93
79
  response = @request_client.conn.post do |req|
94
80
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -110,13 +96,6 @@ module Vapi
110
96
  # @param id [String]
111
97
  # @param request_options [Vapi::RequestOptions]
112
98
  # @return [Vapi::Tools::ToolsGetResponse]
113
- # @example
114
- # api = Vapi::Client.new(
115
- # base_url: "https://api.example.com",
116
- # environment: Vapi::Environment::DEFAULT,
117
- # token: "YOUR_AUTH_TOKEN"
118
- # )
119
- # api.tools.get(id: "id")
120
99
  def get(id:, request_options: nil)
121
100
  response = @request_client.conn.get do |req|
122
101
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -140,13 +119,6 @@ module Vapi
140
119
  # @param id [String]
141
120
  # @param request_options [Vapi::RequestOptions]
142
121
  # @return [Vapi::Tools::ToolsDeleteResponse]
143
- # @example
144
- # api = Vapi::Client.new(
145
- # base_url: "https://api.example.com",
146
- # environment: Vapi::Environment::DEFAULT,
147
- # token: "YOUR_AUTH_TOKEN"
148
- # )
149
- # api.tools.delete(id: "id")
150
122
  def delete(id:, request_options: nil)
151
123
  response = @request_client.conn.delete do |req|
152
124
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -171,13 +143,6 @@ module Vapi
171
143
  # @param request [Vapi::Tools::ToolsUpdateRequest]
172
144
  # @param request_options [Vapi::RequestOptions]
173
145
  # @return [Vapi::Tools::ToolsUpdateResponse]
174
- # @example
175
- # api = Vapi::Client.new(
176
- # base_url: "https://api.example.com",
177
- # environment: Vapi::Environment::DEFAULT,
178
- # token: "YOUR_AUTH_TOKEN"
179
- # )
180
- # api.tools.update(id: "id")
181
146
  def update(id:, request:, request_options: nil)
182
147
  response = @request_client.conn.patch do |req|
183
148
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -222,13 +187,6 @@ module Vapi
222
187
  # specified value.
223
188
  # @param request_options [Vapi::RequestOptions]
224
189
  # @return [Array<Vapi::Tools::ToolsListResponseItem>]
225
- # @example
226
- # api = Vapi::Client.new(
227
- # base_url: "https://api.example.com",
228
- # environment: Vapi::Environment::DEFAULT,
229
- # token: "YOUR_AUTH_TOKEN"
230
- # )
231
- # api.tools.list
232
190
  def list(limit: nil, created_at_gt: nil, created_at_lt: nil, created_at_ge: nil, created_at_le: nil,
233
191
  updated_at_gt: nil, updated_at_lt: nil, updated_at_ge: nil, updated_at_le: nil, request_options: nil)
234
192
  Async do
@@ -268,13 +226,6 @@ module Vapi
268
226
  # @param request [Vapi::Tools::ToolsCreateRequest]
269
227
  # @param request_options [Vapi::RequestOptions]
270
228
  # @return [Vapi::Tools::ToolsCreateResponse]
271
- # @example
272
- # api = Vapi::Client.new(
273
- # base_url: "https://api.example.com",
274
- # environment: Vapi::Environment::DEFAULT,
275
- # token: "YOUR_AUTH_TOKEN"
276
- # )
277
- # api.tools.create
278
229
  def create(request:, request_options: nil)
279
230
  Async do
280
231
  response = @request_client.conn.post do |req|
@@ -298,13 +249,6 @@ module Vapi
298
249
  # @param id [String]
299
250
  # @param request_options [Vapi::RequestOptions]
300
251
  # @return [Vapi::Tools::ToolsGetResponse]
301
- # @example
302
- # api = Vapi::Client.new(
303
- # base_url: "https://api.example.com",
304
- # environment: Vapi::Environment::DEFAULT,
305
- # token: "YOUR_AUTH_TOKEN"
306
- # )
307
- # api.tools.get(id: "id")
308
252
  def get(id:, request_options: nil)
309
253
  Async do
310
254
  response = @request_client.conn.get do |req|
@@ -330,13 +274,6 @@ module Vapi
330
274
  # @param id [String]
331
275
  # @param request_options [Vapi::RequestOptions]
332
276
  # @return [Vapi::Tools::ToolsDeleteResponse]
333
- # @example
334
- # api = Vapi::Client.new(
335
- # base_url: "https://api.example.com",
336
- # environment: Vapi::Environment::DEFAULT,
337
- # token: "YOUR_AUTH_TOKEN"
338
- # )
339
- # api.tools.delete(id: "id")
340
277
  def delete(id:, request_options: nil)
341
278
  Async do
342
279
  response = @request_client.conn.delete do |req|
@@ -363,13 +300,6 @@ module Vapi
363
300
  # @param request [Vapi::Tools::ToolsUpdateRequest]
364
301
  # @param request_options [Vapi::RequestOptions]
365
302
  # @return [Vapi::Tools::ToolsUpdateResponse]
366
- # @example
367
- # api = Vapi::Client.new(
368
- # base_url: "https://api.example.com",
369
- # environment: Vapi::Environment::DEFAULT,
370
- # token: "YOUR_AUTH_TOKEN"
371
- # )
372
- # api.tools.update(id: "id")
373
303
  def update(id:, request:, request_options: nil)
374
304
  Async do
375
305
  response = @request_client.conn.patch do |req|
@@ -4,12 +4,14 @@ module Vapi
4
4
  # This is the region of the Azure resource.
5
5
  class AzureCredentialRegion
6
6
  AUSTRALIA = "australia"
7
- CANADA = "canada"
7
+ CANADAEAST = "canadaeast"
8
+ CANADACENTRAL = "canadacentral"
8
9
  EASTUS_2 = "eastus2"
9
10
  EASTUS = "eastus"
10
11
  FRANCE = "france"
11
12
  INDIA = "india"
12
- JAPAN = "japan"
13
+ JAPANEAST = "japaneast"
14
+ JAPANWEST = "japanwest"
13
15
  UAENORTH = "uaenorth"
14
16
  NORTHCENTRALUS = "northcentralus"
15
17
  NORWAY = "norway"
@@ -3,12 +3,14 @@
3
3
  module Vapi
4
4
  class AzureOpenAiCredentialRegion
5
5
  AUSTRALIA = "australia"
6
- CANADA = "canada"
6
+ CANADAEAST = "canadaeast"
7
+ CANADACENTRAL = "canadacentral"
7
8
  EASTUS_2 = "eastus2"
8
9
  EASTUS = "eastus"
9
10
  FRANCE = "france"
10
11
  INDIA = "india"
11
- JAPAN = "japan"
12
+ JAPANEAST = "japaneast"
13
+ JAPANWEST = "japanwest"
12
14
  UAENORTH = "uaenorth"
13
15
  NORTHCENTRALUS = "northcentralus"
14
16
  NORWAY = "norway"
@@ -0,0 +1,175 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "bash_tool_with_tool_call_messages_item"
4
+ require_relative "tool_call"
5
+ require_relative "open_ai_function"
6
+ require_relative "server"
7
+ require "ostruct"
8
+ require "json"
9
+
10
+ module Vapi
11
+ class BashToolWithToolCall
12
+ # @return [Boolean] This determines if the tool is async.
13
+ # If async, the assistant will move forward without waiting for your server to
14
+ # respond. This is useful if you just want to trigger something on your server.
15
+ # If sync, the assistant will wait for your server to respond. This is useful if
16
+ # want assistant to respond with the result from your server.
17
+ # Defaults to synchronous (`false`).
18
+ attr_reader :async
19
+ # @return [Array<Vapi::BashToolWithToolCallMessagesItem>] These are the messages that will be spoken to the user as the tool is running.
20
+ # For some tools, this is auto-filled based on special fields like
21
+ # `tool.destinations`. For others like the function tool, these can be custom
22
+ # configured.
23
+ attr_reader :messages
24
+ # @return [String] The sub type of tool.
25
+ attr_reader :sub_type
26
+ # @return [Vapi::ToolCall]
27
+ attr_reader :tool_call
28
+ # @return [String] The name of the tool, fixed to 'bash'
29
+ attr_reader :name
30
+ # @return [Vapi::OpenAiFunction] This is the function definition of the tool.
31
+ # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on
32
+ # tool-specific fields like `tool.destinations`. But, even in those cases, you can
33
+ # provide a custom function definition for advanced use cases.
34
+ # An example of an advanced use case is if you want to customize the message
35
+ # that's spoken for `endCall` tool. You can specify a function where it returns an
36
+ # argument "reason". Then, in `messages` array, you can have many
37
+ # "request-complete" messages. One of these messages will be triggered if the
38
+ # `messages[].conditions` matches the "reason" argument.
39
+ attr_reader :function
40
+ # @return [Vapi::Server] This is the server that will be hit when this tool is requested by the model.
41
+ # All requests will be sent with the call object among other things. You can find
42
+ # more details in the Server URL documentation.
43
+ # This overrides the serverUrl set on the org and the phoneNumber. Order of
44
+ # precedence: highest tool.server.url, then assistant.serverUrl, then
45
+ # phoneNumber.serverUrl, then org.serverUrl.
46
+ attr_reader :server
47
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
48
+ attr_reader :additional_properties
49
+ # @return [Object]
50
+ attr_reader :_field_set
51
+ protected :_field_set
52
+
53
+ OMIT = Object.new
54
+
55
+ # @param async [Boolean] This determines if the tool is async.
56
+ # If async, the assistant will move forward without waiting for your server to
57
+ # respond. This is useful if you just want to trigger something on your server.
58
+ # If sync, the assistant will wait for your server to respond. This is useful if
59
+ # want assistant to respond with the result from your server.
60
+ # Defaults to synchronous (`false`).
61
+ # @param messages [Array<Vapi::BashToolWithToolCallMessagesItem>] These are the messages that will be spoken to the user as the tool is running.
62
+ # For some tools, this is auto-filled based on special fields like
63
+ # `tool.destinations`. For others like the function tool, these can be custom
64
+ # configured.
65
+ # @param sub_type [String] The sub type of tool.
66
+ # @param tool_call [Vapi::ToolCall]
67
+ # @param name [String] The name of the tool, fixed to 'bash'
68
+ # @param function [Vapi::OpenAiFunction] This is the function definition of the tool.
69
+ # For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on
70
+ # tool-specific fields like `tool.destinations`. But, even in those cases, you can
71
+ # provide a custom function definition for advanced use cases.
72
+ # An example of an advanced use case is if you want to customize the message
73
+ # that's spoken for `endCall` tool. You can specify a function where it returns an
74
+ # argument "reason". Then, in `messages` array, you can have many
75
+ # "request-complete" messages. One of these messages will be triggered if the
76
+ # `messages[].conditions` matches the "reason" argument.
77
+ # @param server [Vapi::Server] This is the server that will be hit when this tool is requested by the model.
78
+ # All requests will be sent with the call object among other things. You can find
79
+ # more details in the Server URL documentation.
80
+ # This overrides the serverUrl set on the org and the phoneNumber. Order of
81
+ # precedence: highest tool.server.url, then assistant.serverUrl, then
82
+ # phoneNumber.serverUrl, then org.serverUrl.
83
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
84
+ # @return [Vapi::BashToolWithToolCall]
85
+ def initialize(sub_type:, tool_call:, name:, async: OMIT, messages: OMIT, function: OMIT, server: OMIT,
86
+ additional_properties: nil)
87
+ @async = async if async != OMIT
88
+ @messages = messages if messages != OMIT
89
+ @sub_type = sub_type
90
+ @tool_call = tool_call
91
+ @name = name
92
+ @function = function if function != OMIT
93
+ @server = server if server != OMIT
94
+ @additional_properties = additional_properties
95
+ @_field_set = {
96
+ "async": async,
97
+ "messages": messages,
98
+ "subType": sub_type,
99
+ "toolCall": tool_call,
100
+ "name": name,
101
+ "function": function,
102
+ "server": server
103
+ }.reject do |_k, v|
104
+ v == OMIT
105
+ end
106
+ end
107
+
108
+ # Deserialize a JSON object to an instance of BashToolWithToolCall
109
+ #
110
+ # @param json_object [String]
111
+ # @return [Vapi::BashToolWithToolCall]
112
+ def self.from_json(json_object:)
113
+ struct = JSON.parse(json_object, object_class: OpenStruct)
114
+ parsed_json = JSON.parse(json_object)
115
+ async = parsed_json["async"]
116
+ messages = parsed_json["messages"]&.map do |item|
117
+ item = item.to_json
118
+ Vapi::BashToolWithToolCallMessagesItem.from_json(json_object: item)
119
+ end
120
+ sub_type = parsed_json["subType"]
121
+ if parsed_json["toolCall"].nil?
122
+ tool_call = nil
123
+ else
124
+ tool_call = parsed_json["toolCall"].to_json
125
+ tool_call = Vapi::ToolCall.from_json(json_object: tool_call)
126
+ end
127
+ name = parsed_json["name"]
128
+ if parsed_json["function"].nil?
129
+ function = nil
130
+ else
131
+ function = parsed_json["function"].to_json
132
+ function = Vapi::OpenAiFunction.from_json(json_object: function)
133
+ end
134
+ if parsed_json["server"].nil?
135
+ server = nil
136
+ else
137
+ server = parsed_json["server"].to_json
138
+ server = Vapi::Server.from_json(json_object: server)
139
+ end
140
+ new(
141
+ async: async,
142
+ messages: messages,
143
+ sub_type: sub_type,
144
+ tool_call: tool_call,
145
+ name: name,
146
+ function: function,
147
+ server: server,
148
+ additional_properties: struct
149
+ )
150
+ end
151
+
152
+ # Serialize an instance of BashToolWithToolCall to a JSON object
153
+ #
154
+ # @return [String]
155
+ def to_json(*_args)
156
+ @_field_set&.to_json
157
+ end
158
+
159
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
160
+ # hash and check each fields type against the current object's property
161
+ # definitions.
162
+ #
163
+ # @param obj [Object]
164
+ # @return [Void]
165
+ def self.validate_raw(obj:)
166
+ obj.async&.is_a?(Boolean) != false || raise("Passed value for field obj.async is not the expected type, validation failed.")
167
+ obj.messages&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.")
168
+ obj.sub_type.is_a?(String) != false || raise("Passed value for field obj.sub_type is not the expected type, validation failed.")
169
+ Vapi::ToolCall.validate_raw(obj: obj.tool_call)
170
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
171
+ obj.function.nil? || Vapi::OpenAiFunction.validate_raw(obj: obj.function)
172
+ obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server)
173
+ end
174
+ end
175
+ end
@@ -0,0 +1,120 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require_relative "tool_message_start"
5
+ require_relative "tool_message_complete"
6
+ require_relative "tool_message_failed"
7
+ require_relative "tool_message_delayed"
8
+
9
+ module Vapi
10
+ class BashToolWithToolCallMessagesItem
11
+ # @return [Object]
12
+ attr_reader :member
13
+ # @return [String]
14
+ attr_reader :discriminant
15
+
16
+ private_class_method :new
17
+ alias kind_of? is_a?
18
+
19
+ # @param member [Object]
20
+ # @param discriminant [String]
21
+ # @return [Vapi::BashToolWithToolCallMessagesItem]
22
+ def initialize(member:, discriminant:)
23
+ @member = member
24
+ @discriminant = discriminant
25
+ end
26
+
27
+ # Deserialize a JSON object to an instance of BashToolWithToolCallMessagesItem
28
+ #
29
+ # @param json_object [String]
30
+ # @return [Vapi::BashToolWithToolCallMessagesItem]
31
+ def self.from_json(json_object:)
32
+ struct = JSON.parse(json_object, object_class: OpenStruct)
33
+ member = case struct.type
34
+ when "request-start"
35
+ Vapi::ToolMessageStart.from_json(json_object: json_object)
36
+ when "request-complete"
37
+ Vapi::ToolMessageComplete.from_json(json_object: json_object)
38
+ when "request-failed"
39
+ Vapi::ToolMessageFailed.from_json(json_object: json_object)
40
+ when "request-response-delayed"
41
+ Vapi::ToolMessageDelayed.from_json(json_object: json_object)
42
+ else
43
+ Vapi::ToolMessageStart.from_json(json_object: json_object)
44
+ end
45
+ new(member: member, discriminant: struct.type)
46
+ end
47
+
48
+ # For Union Types, to_json functionality is delegated to the wrapped member.
49
+ #
50
+ # @return [String]
51
+ def to_json(*_args)
52
+ case @discriminant
53
+ when "request-start"
54
+ { **@member.to_json, type: @discriminant }.to_json
55
+ when "request-complete"
56
+ { **@member.to_json, type: @discriminant }.to_json
57
+ when "request-failed"
58
+ { **@member.to_json, type: @discriminant }.to_json
59
+ when "request-response-delayed"
60
+ { **@member.to_json, type: @discriminant }.to_json
61
+ else
62
+ { "type": @discriminant, value: @member }.to_json
63
+ end
64
+ @member.to_json
65
+ end
66
+
67
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
68
+ # hash and check each fields type against the current object's property
69
+ # definitions.
70
+ #
71
+ # @param obj [Object]
72
+ # @return [Void]
73
+ def self.validate_raw(obj:)
74
+ case obj.type
75
+ when "request-start"
76
+ Vapi::ToolMessageStart.validate_raw(obj: obj)
77
+ when "request-complete"
78
+ Vapi::ToolMessageComplete.validate_raw(obj: obj)
79
+ when "request-failed"
80
+ Vapi::ToolMessageFailed.validate_raw(obj: obj)
81
+ when "request-response-delayed"
82
+ Vapi::ToolMessageDelayed.validate_raw(obj: obj)
83
+ else
84
+ raise("Passed value matched no type within the union, validation failed.")
85
+ end
86
+ end
87
+
88
+ # For Union Types, is_a? functionality is delegated to the wrapped member.
89
+ #
90
+ # @param obj [Object]
91
+ # @return [Boolean]
92
+ def is_a?(obj)
93
+ @member.is_a?(obj)
94
+ end
95
+
96
+ # @param member [Vapi::ToolMessageStart]
97
+ # @return [Vapi::BashToolWithToolCallMessagesItem]
98
+ def self.request_start(member:)
99
+ new(member: member, discriminant: "request-start")
100
+ end
101
+
102
+ # @param member [Vapi::ToolMessageComplete]
103
+ # @return [Vapi::BashToolWithToolCallMessagesItem]
104
+ def self.request_complete(member:)
105
+ new(member: member, discriminant: "request-complete")
106
+ end
107
+
108
+ # @param member [Vapi::ToolMessageFailed]
109
+ # @return [Vapi::BashToolWithToolCallMessagesItem]
110
+ def self.request_failed(member:)
111
+ new(member: member, discriminant: "request-failed")
112
+ end
113
+
114
+ # @param member [Vapi::ToolMessageDelayed]
115
+ # @return [Vapi::BashToolWithToolCallMessagesItem]
116
+ def self.request_response_delayed(member:)
117
+ new(member: member, discriminant: "request-response-delayed")
118
+ end
119
+ end
120
+ end