Class: Vapi::TrieveKnowledgeBase
- Inherits:
-
Object
- Object
- Vapi::TrieveKnowledgeBase
- Defined in:
- lib/vapi_server_sdk/types/trieve_knowledge_base.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#create_plan ⇒ Vapi::TrieveKnowledgeBaseImport
readonly
This is the plan if you want us to create/import a new vector store using Trieve.
-
#id ⇒ String
readonly
This is the id of the knowledge base.
-
#name ⇒ String
readonly
This is the name of the knowledge base.
-
#org_id ⇒ String
readonly
This is the org id of the knowledge base.
-
#search_plan ⇒ Vapi::TrieveKnowledgeBaseSearchPlan
readonly
This is the searching plan used when searching for relevant chunks from the vector store.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::TrieveKnowledgeBase
Deserialize a JSON object to an instance of TrieveKnowledgeBase.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(id:, org_id:, name: OMIT, search_plan: OMIT, create_plan: OMIT, additional_properties: nil) ⇒ Vapi::TrieveKnowledgeBase constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of TrieveKnowledgeBase to a JSON object.
Constructor Details
#initialize(id:, org_id:, name: OMIT, search_plan: OMIT, create_plan: OMIT, additional_properties: nil) ⇒ Vapi::TrieveKnowledgeBase
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base.rb', line 45 def initialize(id:, org_id:, name: OMIT, search_plan: OMIT, create_plan: OMIT, additional_properties: nil) @name = name if name != OMIT @search_plan = search_plan if search_plan != OMIT @create_plan = create_plan if create_plan != OMIT @id = id @org_id = org_id @additional_properties = additional_properties @_field_set = { "name": name, "searchPlan": search_plan, "createPlan": create_plan, "id": id, "orgId": org_id }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
26 27 28 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base.rb', line 26 def additional_properties @additional_properties end |
#create_plan ⇒ Vapi::TrieveKnowledgeBaseImport (readonly)
20 21 22 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base.rb', line 20 def create_plan @create_plan end |
#id ⇒ String (readonly)
22 23 24 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base.rb', line 22 def id @id end |
#name ⇒ String (readonly)
11 12 13 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base.rb', line 11 def name @name end |
#org_id ⇒ String (readonly)
24 25 26 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base.rb', line 24 def org_id @org_id end |
#search_plan ⇒ Vapi::TrieveKnowledgeBaseSearchPlan (readonly)
17 18 19 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base.rb', line 17 def search_plan @search_plan end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::TrieveKnowledgeBase
Deserialize a JSON object to an instance of TrieveKnowledgeBase
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base.rb', line 67 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) name = parsed_json["name"] if parsed_json["searchPlan"].nil? search_plan = nil else search_plan = parsed_json["searchPlan"].to_json search_plan = Vapi::TrieveKnowledgeBaseSearchPlan.from_json(json_object: search_plan) end if parsed_json["createPlan"].nil? create_plan = nil else create_plan = parsed_json["createPlan"].to_json create_plan = Vapi::TrieveKnowledgeBaseImport.from_json(json_object: create_plan) end id = parsed_json["id"] org_id = parsed_json["orgId"] new( name: name, search_plan: search_plan, create_plan: create_plan, id: id, org_id: org_id, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
108 109 110 111 112 113 114 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base.rb', line 108 def self.validate_raw(obj:) obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.search_plan.nil? || Vapi::TrieveKnowledgeBaseSearchPlan.validate_raw(obj: obj.search_plan) obj.create_plan.nil? || Vapi::TrieveKnowledgeBaseImport.validate_raw(obj: obj.create_plan) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of TrieveKnowledgeBase to a JSON object
98 99 100 |
# File 'lib/vapi_server_sdk/types/trieve_knowledge_base.rb', line 98 def to_json(*_args) @_field_set&.to_json end |