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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "trieve_knowledge_base_vector_store_search_plan"
4
- require_relative "trieve_knowledge_base_vector_store_create_plan"
3
+ require_relative "trieve_knowledge_base_search_plan"
4
+ require_relative "trieve_knowledge_base_create_plan"
5
5
  require "ostruct"
6
6
  require "json"
7
7
 
@@ -9,17 +9,15 @@ module Vapi
9
9
  class TrieveKnowledgeBase
10
10
  # @return [String] This is the name of the knowledge base.
11
11
  attr_reader :name
12
- # @return [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan] This is the plan on how to search the vector store while a call is going on.
13
- attr_reader :vector_store_search_plan
14
- # @return [Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan] This is the plan if you want us to create a new vector store on your behalf. To
15
- # use an existing vector store from your account, use `vectoreStoreProviderId`
16
- attr_reader :vector_store_create_plan
17
- # @return [String] This is an vector store that you already have on your account with the provider.
18
- # To create a new vector store, use vectorStoreCreatePlan.
19
- # Usage:
20
- # - To bring your own vector store from Trieve, go to https://trieve.ai
21
- # - Create a dataset, and use the datasetId here.
22
- attr_reader :vector_store_provider_id
12
+ # @return [Vapi::TrieveKnowledgeBaseSearchPlan] This is the searching plan used when searching for relevant chunks from the
13
+ # vector store.
14
+ # You should configure this if you're running into these issues:
15
+ # - Too much unnecessary context is being fed as knowledge base context.
16
+ # - Not enough relevant context is being fed as knowledge base context.
17
+ attr_reader :search_plan
18
+ # @return [Vapi::TrieveKnowledgeBaseCreatePlan] This is the plan if you want us to create/import a new vector store using
19
+ # Trieve.
20
+ attr_reader :create_plan
23
21
  # @return [String] This is the id of the knowledge base.
24
22
  attr_reader :id
25
23
  # @return [String] This is the org id of the knowledge base.
@@ -33,32 +31,28 @@ module Vapi
33
31
  OMIT = Object.new
34
32
 
35
33
  # @param name [String] This is the name of the knowledge base.
36
- # @param vector_store_search_plan [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan] This is the plan on how to search the vector store while a call is going on.
37
- # @param vector_store_create_plan [Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan] This is the plan if you want us to create a new vector store on your behalf. To
38
- # use an existing vector store from your account, use `vectoreStoreProviderId`
39
- # @param vector_store_provider_id [String] This is an vector store that you already have on your account with the provider.
40
- # To create a new vector store, use vectorStoreCreatePlan.
41
- # Usage:
42
- # - To bring your own vector store from Trieve, go to https://trieve.ai
43
- # - Create a dataset, and use the datasetId here.
34
+ # @param search_plan [Vapi::TrieveKnowledgeBaseSearchPlan] This is the searching plan used when searching for relevant chunks from the
35
+ # vector store.
36
+ # You should configure this if you're running into these issues:
37
+ # - Too much unnecessary context is being fed as knowledge base context.
38
+ # - Not enough relevant context is being fed as knowledge base context.
39
+ # @param create_plan [Vapi::TrieveKnowledgeBaseCreatePlan] This is the plan if you want us to create/import a new vector store using
40
+ # Trieve.
44
41
  # @param id [String] This is the id of the knowledge base.
45
42
  # @param org_id [String] This is the org id of the knowledge base.
46
43
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
47
44
  # @return [Vapi::TrieveKnowledgeBase]
48
- def initialize(vector_store_search_plan:, id:, org_id:, name: OMIT, vector_store_create_plan: OMIT,
49
- vector_store_provider_id: OMIT, additional_properties: nil)
45
+ def initialize(id:, org_id:, name: OMIT, search_plan: OMIT, create_plan: OMIT, additional_properties: nil)
50
46
  @name = name if name != OMIT
51
- @vector_store_search_plan = vector_store_search_plan
52
- @vector_store_create_plan = vector_store_create_plan if vector_store_create_plan != OMIT
53
- @vector_store_provider_id = vector_store_provider_id if vector_store_provider_id != OMIT
47
+ @search_plan = search_plan if search_plan != OMIT
48
+ @create_plan = create_plan if create_plan != OMIT
54
49
  @id = id
55
50
  @org_id = org_id
56
51
  @additional_properties = additional_properties
57
52
  @_field_set = {
58
53
  "name": name,
59
- "vectorStoreSearchPlan": vector_store_search_plan,
60
- "vectorStoreCreatePlan": vector_store_create_plan,
61
- "vectorStoreProviderId": vector_store_provider_id,
54
+ "searchPlan": search_plan,
55
+ "createPlan": create_plan,
62
56
  "id": id,
63
57
  "orgId": org_id
64
58
  }.reject do |_k, v|
@@ -74,26 +68,24 @@ module Vapi
74
68
  struct = JSON.parse(json_object, object_class: OpenStruct)
75
69
  parsed_json = JSON.parse(json_object)
76
70
  name = parsed_json["name"]
77
- if parsed_json["vectorStoreSearchPlan"].nil?
78
- vector_store_search_plan = nil
71
+ if parsed_json["searchPlan"].nil?
72
+ search_plan = nil
79
73
  else
80
- vector_store_search_plan = parsed_json["vectorStoreSearchPlan"].to_json
81
- vector_store_search_plan = Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan.from_json(json_object: vector_store_search_plan)
74
+ search_plan = parsed_json["searchPlan"].to_json
75
+ search_plan = Vapi::TrieveKnowledgeBaseSearchPlan.from_json(json_object: search_plan)
82
76
  end
83
- if parsed_json["vectorStoreCreatePlan"].nil?
84
- vector_store_create_plan = nil
77
+ if parsed_json["createPlan"].nil?
78
+ create_plan = nil
85
79
  else
86
- vector_store_create_plan = parsed_json["vectorStoreCreatePlan"].to_json
87
- vector_store_create_plan = Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan.from_json(json_object: vector_store_create_plan)
80
+ create_plan = parsed_json["createPlan"].to_json
81
+ create_plan = Vapi::TrieveKnowledgeBaseCreatePlan.from_json(json_object: create_plan)
88
82
  end
89
- vector_store_provider_id = parsed_json["vectorStoreProviderId"]
90
83
  id = parsed_json["id"]
91
84
  org_id = parsed_json["orgId"]
92
85
  new(
93
86
  name: name,
94
- vector_store_search_plan: vector_store_search_plan,
95
- vector_store_create_plan: vector_store_create_plan,
96
- vector_store_provider_id: vector_store_provider_id,
87
+ search_plan: search_plan,
88
+ create_plan: create_plan,
97
89
  id: id,
98
90
  org_id: org_id,
99
91
  additional_properties: struct
@@ -115,9 +107,8 @@ module Vapi
115
107
  # @return [Void]
116
108
  def self.validate_raw(obj:)
117
109
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
118
- Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan.validate_raw(obj: obj.vector_store_search_plan)
119
- obj.vector_store_create_plan.nil? || Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan.validate_raw(obj: obj.vector_store_create_plan)
120
- obj.vector_store_provider_id&.is_a?(String) != false || raise("Passed value for field obj.vector_store_provider_id is not the expected type, validation failed.")
110
+ obj.search_plan.nil? || Vapi::TrieveKnowledgeBaseSearchPlan.validate_raw(obj: obj.search_plan)
111
+ obj.create_plan.nil? || Vapi::TrieveKnowledgeBaseCreatePlan.validate_raw(obj: obj.create_plan)
121
112
  obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
122
113
  obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.")
123
114
  end
@@ -4,10 +4,12 @@ require "ostruct"
4
4
  require "json"
5
5
 
6
6
  module Vapi
7
- class TrieveKnowledgeBaseVectorStoreCreatePlan
7
+ class TrieveKnowledgeBaseChunkPlan
8
8
  # @return [Array<String>] These are the file ids that will be used to create the vector store. To upload
9
9
  # files, use the `POST /files` endpoint.
10
10
  attr_reader :file_ids
11
+ # @return [Array<String>] These are the websites that will be used to create the vector store.
12
+ attr_reader :websites
11
13
  # @return [Float] This is an optional field which allows you to specify the number of splits you
12
14
  # want per chunk. If not specified, the default 20 is used. However, you may want
13
15
  # to use a different number.
@@ -33,6 +35,7 @@ module Vapi
33
35
 
34
36
  # @param file_ids [Array<String>] These are the file ids that will be used to create the vector store. To upload
35
37
  # files, use the `POST /files` endpoint.
38
+ # @param websites [Array<String>] These are the websites that will be used to create the vector store.
36
39
  # @param target_splits_per_chunk [Float] This is an optional field which allows you to specify the number of splits you
37
40
  # want per chunk. If not specified, the default 20 is used. However, you may want
38
41
  # to use a different number.
@@ -46,16 +49,18 @@ module Vapi
46
49
  # such that 66 splits with a target_splits_per_chunk of 20 will result in 3 chunks
47
50
  # with 22 splits each.
48
51
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
49
- # @return [Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan]
50
- def initialize(file_ids:, target_splits_per_chunk: OMIT, split_delimiters: OMIT, rebalance_chunks: OMIT,
51
- additional_properties: nil)
52
- @file_ids = file_ids
52
+ # @return [Vapi::TrieveKnowledgeBaseChunkPlan]
53
+ def initialize(file_ids: OMIT, websites: OMIT, target_splits_per_chunk: OMIT, split_delimiters: OMIT,
54
+ rebalance_chunks: OMIT, additional_properties: nil)
55
+ @file_ids = file_ids if file_ids != OMIT
56
+ @websites = websites if websites != OMIT
53
57
  @target_splits_per_chunk = target_splits_per_chunk if target_splits_per_chunk != OMIT
54
58
  @split_delimiters = split_delimiters if split_delimiters != OMIT
55
59
  @rebalance_chunks = rebalance_chunks if rebalance_chunks != OMIT
56
60
  @additional_properties = additional_properties
57
61
  @_field_set = {
58
62
  "fileIds": file_ids,
63
+ "websites": websites,
59
64
  "targetSplitsPerChunk": target_splits_per_chunk,
60
65
  "splitDelimiters": split_delimiters,
61
66
  "rebalanceChunks": rebalance_chunks
@@ -64,20 +69,21 @@ module Vapi
64
69
  end
65
70
  end
66
71
 
67
- # Deserialize a JSON object to an instance of
68
- # TrieveKnowledgeBaseVectorStoreCreatePlan
72
+ # Deserialize a JSON object to an instance of TrieveKnowledgeBaseChunkPlan
69
73
  #
70
74
  # @param json_object [String]
71
- # @return [Vapi::TrieveKnowledgeBaseVectorStoreCreatePlan]
75
+ # @return [Vapi::TrieveKnowledgeBaseChunkPlan]
72
76
  def self.from_json(json_object:)
73
77
  struct = JSON.parse(json_object, object_class: OpenStruct)
74
78
  parsed_json = JSON.parse(json_object)
75
79
  file_ids = parsed_json["fileIds"]
80
+ websites = parsed_json["websites"]
76
81
  target_splits_per_chunk = parsed_json["targetSplitsPerChunk"]
77
82
  split_delimiters = parsed_json["splitDelimiters"]
78
83
  rebalance_chunks = parsed_json["rebalanceChunks"]
79
84
  new(
80
85
  file_ids: file_ids,
86
+ websites: websites,
81
87
  target_splits_per_chunk: target_splits_per_chunk,
82
88
  split_delimiters: split_delimiters,
83
89
  rebalance_chunks: rebalance_chunks,
@@ -85,8 +91,7 @@ module Vapi
85
91
  )
86
92
  end
87
93
 
88
- # Serialize an instance of TrieveKnowledgeBaseVectorStoreCreatePlan to a JSON
89
- # object
94
+ # Serialize an instance of TrieveKnowledgeBaseChunkPlan to a JSON object
90
95
  #
91
96
  # @return [String]
92
97
  def to_json(*_args)
@@ -100,7 +105,8 @@ module Vapi
100
105
  # @param obj [Object]
101
106
  # @return [Void]
102
107
  def self.validate_raw(obj:)
103
- obj.file_ids.is_a?(Array) != false || raise("Passed value for field obj.file_ids is not the expected type, validation failed.")
108
+ obj.file_ids&.is_a?(Array) != false || raise("Passed value for field obj.file_ids is not the expected type, validation failed.")
109
+ obj.websites&.is_a?(Array) != false || raise("Passed value for field obj.websites is not the expected type, validation failed.")
104
110
  obj.target_splits_per_chunk&.is_a?(Float) != false || raise("Passed value for field obj.target_splits_per_chunk is not the expected type, validation failed.")
105
111
  obj.split_delimiters&.is_a?(Array) != false || raise("Passed value for field obj.split_delimiters is not the expected type, validation failed.")
106
112
  obj.rebalance_chunks&.is_a?(Boolean) != false || raise("Passed value for field obj.rebalance_chunks is not the expected type, validation failed.")
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "trieve_knowledge_base_chunk_plan"
4
+ require "ostruct"
5
+ require "json"
6
+
7
+ module Vapi
8
+ class TrieveKnowledgeBaseCreate
9
+ # @return [Array<Vapi::TrieveKnowledgeBaseChunkPlan>] These are the chunk plans used to create the dataset.
10
+ attr_reader :chunk_plans
11
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
12
+ attr_reader :additional_properties
13
+ # @return [Object]
14
+ attr_reader :_field_set
15
+ protected :_field_set
16
+
17
+ OMIT = Object.new
18
+
19
+ # @param chunk_plans [Array<Vapi::TrieveKnowledgeBaseChunkPlan>] These are the chunk plans used to create the dataset.
20
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
21
+ # @return [Vapi::TrieveKnowledgeBaseCreate]
22
+ def initialize(chunk_plans:, additional_properties: nil)
23
+ @chunk_plans = chunk_plans
24
+ @additional_properties = additional_properties
25
+ @_field_set = { "chunkPlans": chunk_plans }
26
+ end
27
+
28
+ # Deserialize a JSON object to an instance of TrieveKnowledgeBaseCreate
29
+ #
30
+ # @param json_object [String]
31
+ # @return [Vapi::TrieveKnowledgeBaseCreate]
32
+ def self.from_json(json_object:)
33
+ struct = JSON.parse(json_object, object_class: OpenStruct)
34
+ parsed_json = JSON.parse(json_object)
35
+ chunk_plans = parsed_json["chunkPlans"]&.map do |item|
36
+ item = item.to_json
37
+ Vapi::TrieveKnowledgeBaseChunkPlan.from_json(json_object: item)
38
+ end
39
+ new(chunk_plans: chunk_plans, additional_properties: struct)
40
+ end
41
+
42
+ # Serialize an instance of TrieveKnowledgeBaseCreate to a JSON object
43
+ #
44
+ # @return [String]
45
+ def to_json(*_args)
46
+ @_field_set&.to_json
47
+ end
48
+
49
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
50
+ # hash and check each fields type against the current object's property
51
+ # definitions.
52
+ #
53
+ # @param obj [Object]
54
+ # @return [Void]
55
+ def self.validate_raw(obj:)
56
+ obj.chunk_plans.is_a?(Array) != false || raise("Passed value for field obj.chunk_plans is not the expected type, validation failed.")
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require_relative "trieve_knowledge_base_create"
5
+ require_relative "trieve_knowledge_base_import"
6
+
7
+ module Vapi
8
+ # This is the plan if you want us to create/import a new vector store using
9
+ # Trieve.
10
+ class TrieveKnowledgeBaseCreatePlan
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::TrieveKnowledgeBaseCreatePlan]
22
+ def initialize(member:, discriminant:)
23
+ @member = member
24
+ @discriminant = discriminant
25
+ end
26
+
27
+ # Deserialize a JSON object to an instance of TrieveKnowledgeBaseCreatePlan
28
+ #
29
+ # @param json_object [String]
30
+ # @return [Vapi::TrieveKnowledgeBaseCreatePlan]
31
+ def self.from_json(json_object:)
32
+ struct = JSON.parse(json_object, object_class: OpenStruct)
33
+ member = case struct.type
34
+ when "create"
35
+ Vapi::TrieveKnowledgeBaseCreate.from_json(json_object: json_object)
36
+ when "import"
37
+ Vapi::TrieveKnowledgeBaseImport.from_json(json_object: json_object)
38
+ else
39
+ Vapi::TrieveKnowledgeBaseCreate.from_json(json_object: json_object)
40
+ end
41
+ new(member: member, discriminant: struct.type)
42
+ end
43
+
44
+ # For Union Types, to_json functionality is delegated to the wrapped member.
45
+ #
46
+ # @return [String]
47
+ def to_json(*_args)
48
+ case @discriminant
49
+ when "create"
50
+ { **@member.to_json, type: @discriminant }.to_json
51
+ when "import"
52
+ { **@member.to_json, type: @discriminant }.to_json
53
+ else
54
+ { "type": @discriminant, value: @member }.to_json
55
+ end
56
+ @member.to_json
57
+ end
58
+
59
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
60
+ # hash and check each fields type against the current object's property
61
+ # definitions.
62
+ #
63
+ # @param obj [Object]
64
+ # @return [Void]
65
+ def self.validate_raw(obj:)
66
+ case obj.type
67
+ when "create"
68
+ Vapi::TrieveKnowledgeBaseCreate.validate_raw(obj: obj)
69
+ when "import"
70
+ Vapi::TrieveKnowledgeBaseImport.validate_raw(obj: obj)
71
+ else
72
+ raise("Passed value matched no type within the union, validation failed.")
73
+ end
74
+ end
75
+
76
+ # For Union Types, is_a? functionality is delegated to the wrapped member.
77
+ #
78
+ # @param obj [Object]
79
+ # @return [Boolean]
80
+ def is_a?(obj)
81
+ @member.is_a?(obj)
82
+ end
83
+
84
+ # @param member [Vapi::TrieveKnowledgeBaseCreate]
85
+ # @return [Vapi::TrieveKnowledgeBaseCreatePlan]
86
+ def self.create(member:)
87
+ new(member: member, discriminant: "create")
88
+ end
89
+
90
+ # @param member [Vapi::TrieveKnowledgeBaseImport]
91
+ # @return [Vapi::TrieveKnowledgeBaseCreatePlan]
92
+ def self.import(member:)
93
+ new(member: member, discriminant: "import")
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Vapi
7
+ class TrieveKnowledgeBaseImport
8
+ # @return [String] This is the `datasetId` of the dataset on your Trieve account.
9
+ attr_reader :provider_id
10
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
11
+ attr_reader :additional_properties
12
+ # @return [Object]
13
+ attr_reader :_field_set
14
+ protected :_field_set
15
+
16
+ OMIT = Object.new
17
+
18
+ # @param provider_id [String] This is the `datasetId` of the dataset on your Trieve account.
19
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
20
+ # @return [Vapi::TrieveKnowledgeBaseImport]
21
+ def initialize(provider_id:, additional_properties: nil)
22
+ @provider_id = provider_id
23
+ @additional_properties = additional_properties
24
+ @_field_set = { "providerId": provider_id }
25
+ end
26
+
27
+ # Deserialize a JSON object to an instance of TrieveKnowledgeBaseImport
28
+ #
29
+ # @param json_object [String]
30
+ # @return [Vapi::TrieveKnowledgeBaseImport]
31
+ def self.from_json(json_object:)
32
+ struct = JSON.parse(json_object, object_class: OpenStruct)
33
+ parsed_json = JSON.parse(json_object)
34
+ provider_id = parsed_json["providerId"]
35
+ new(provider_id: provider_id, additional_properties: struct)
36
+ end
37
+
38
+ # Serialize an instance of TrieveKnowledgeBaseImport to a JSON object
39
+ #
40
+ # @return [String]
41
+ def to_json(*_args)
42
+ @_field_set&.to_json
43
+ end
44
+
45
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
46
+ # hash and check each fields type against the current object's property
47
+ # definitions.
48
+ #
49
+ # @param obj [Object]
50
+ # @return [Void]
51
+ def self.validate_raw(obj:)
52
+ obj.provider_id.is_a?(String) != false || raise("Passed value for field obj.provider_id is not the expected type, validation failed.")
53
+ end
54
+ end
55
+ end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "trieve_knowledge_base_vector_store_search_plan_search_type"
3
+ require_relative "trieve_knowledge_base_search_plan_search_type"
4
4
  require "ostruct"
5
5
  require "json"
6
6
 
7
7
  module Vapi
8
- class TrieveKnowledgeBaseVectorStoreSearchPlan
8
+ class TrieveKnowledgeBaseSearchPlan
9
9
  # @return [Boolean] If true, stop words (specified in server/src/stop-words.txt in the git repo)
10
10
  # will be removed. This will preserve queries that are entirely stop words.
11
11
  attr_reader :remove_stop_words
@@ -16,7 +16,7 @@ module Vapi
16
16
  # specified, this defaults to no threshold. A threshold of 0 will default to no
17
17
  # threshold.
18
18
  attr_reader :score_threshold
19
- # @return [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlanSearchType] This is the search method used when searching for relevant chunks from the
19
+ # @return [Vapi::TrieveKnowledgeBaseSearchPlanSearchType] This is the search method used when searching for relevant chunks from the
20
20
  # vector store.
21
21
  attr_reader :search_type
22
22
  # @return [OpenStruct] Additional properties unmapped to the current class definition
@@ -35,10 +35,10 @@ module Vapi
35
35
  # distance. This threshold applies before weight and bias modifications. If not
36
36
  # specified, this defaults to no threshold. A threshold of 0 will default to no
37
37
  # threshold.
38
- # @param search_type [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlanSearchType] This is the search method used when searching for relevant chunks from the
38
+ # @param search_type [Vapi::TrieveKnowledgeBaseSearchPlanSearchType] This is the search method used when searching for relevant chunks from the
39
39
  # vector store.
40
40
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
41
- # @return [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan]
41
+ # @return [Vapi::TrieveKnowledgeBaseSearchPlan]
42
42
  def initialize(search_type:, remove_stop_words: OMIT, score_threshold: OMIT, additional_properties: nil)
43
43
  @remove_stop_words = remove_stop_words if remove_stop_words != OMIT
44
44
  @score_threshold = score_threshold if score_threshold != OMIT
@@ -53,11 +53,10 @@ module Vapi
53
53
  end
54
54
  end
55
55
 
56
- # Deserialize a JSON object to an instance of
57
- # TrieveKnowledgeBaseVectorStoreSearchPlan
56
+ # Deserialize a JSON object to an instance of TrieveKnowledgeBaseSearchPlan
58
57
  #
59
58
  # @param json_object [String]
60
- # @return [Vapi::TrieveKnowledgeBaseVectorStoreSearchPlan]
59
+ # @return [Vapi::TrieveKnowledgeBaseSearchPlan]
61
60
  def self.from_json(json_object:)
62
61
  struct = JSON.parse(json_object, object_class: OpenStruct)
63
62
  parsed_json = JSON.parse(json_object)
@@ -72,8 +71,7 @@ module Vapi
72
71
  )
73
72
  end
74
73
 
75
- # Serialize an instance of TrieveKnowledgeBaseVectorStoreSearchPlan to a JSON
76
- # object
74
+ # Serialize an instance of TrieveKnowledgeBaseSearchPlan to a JSON object
77
75
  #
78
76
  # @return [String]
79
77
  def to_json(*_args)
@@ -89,7 +87,7 @@ module Vapi
89
87
  def self.validate_raw(obj:)
90
88
  obj.remove_stop_words&.is_a?(Boolean) != false || raise("Passed value for field obj.remove_stop_words is not the expected type, validation failed.")
91
89
  obj.score_threshold&.is_a?(Float) != false || raise("Passed value for field obj.score_threshold is not the expected type, validation failed.")
92
- obj.search_type.is_a?(Vapi::TrieveKnowledgeBaseVectorStoreSearchPlanSearchType) != false || raise("Passed value for field obj.search_type is not the expected type, validation failed.")
90
+ obj.search_type.is_a?(Vapi::TrieveKnowledgeBaseSearchPlanSearchType) != false || raise("Passed value for field obj.search_type is not the expected type, validation failed.")
93
91
  end
94
92
  end
95
93
  end
@@ -3,7 +3,7 @@
3
3
  module Vapi
4
4
  # This is the search method used when searching for relevant chunks from the
5
5
  # vector store.
6
- class TrieveKnowledgeBaseVectorStoreSearchPlanSearchType
6
+ class TrieveKnowledgeBaseSearchPlanSearchType
7
7
  FULLTEXT = "fulltext"
8
8
  SEMANTIC = "semantic"
9
9
  HYBRID = "hybrid"
@@ -4,12 +4,14 @@ module Vapi
4
4
  # This is the region of the Azure resource.
5
5
  class UpdateAzureCredentialDtoRegion
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 UpdateAzureOpenAiCredentialDtoRegion
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"
@@ -6,8 +6,7 @@ require "json"
6
6
 
7
7
  module Vapi
8
8
  class UpdateCustomKnowledgeBaseDto
9
- # @return [Vapi::Server] /**
10
- # This is where the knowledge base request will be sent.
9
+ # @return [Vapi::Server] This is where the knowledge base request will be sent.
11
10
  # Request Example:
12
11
  # POST https://{server.url}
13
12
  # Content-Type: application/json
@@ -54,8 +53,7 @@ module Vapi
54
53
 
55
54
  OMIT = Object.new
56
55
 
57
- # @param server [Vapi::Server] /**
58
- # This is where the knowledge base request will be sent.
56
+ # @param server [Vapi::Server] This is where the knowledge base request will be sent.
59
57
  # Request Example:
60
58
  # POST https://{server.url}
61
59
  # Content-Type: application/json