Class: Vapi::KnowledgeBase
- Inherits:
-
Object
- Object
- Vapi::KnowledgeBase
- Defined in:
- lib/vapi_server_sdk/types/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.
-
#description ⇒ String
readonly
A description of the knowledge base.
-
#file_ids ⇒ Array<String>
readonly
The file IDs associated with this knowledge base.
-
#model ⇒ Vapi::KnowledgeBaseModel
readonly
The model to use for the knowledge base.
-
#name ⇒ String
readonly
The name of the knowledge base.
-
#provider ⇒ String
readonly
The provider of the knowledge base.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::KnowledgeBase
Deserialize a JSON object to an instance of KnowledgeBase.
-
.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(name:, provider:, description:, file_ids:, model: OMIT, additional_properties: nil) ⇒ Vapi::KnowledgeBase constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of KnowledgeBase to a JSON object.
Constructor Details
#initialize(name:, provider:, description:, file_ids:, model: OMIT, additional_properties: nil) ⇒ Vapi::KnowledgeBase
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/vapi_server_sdk/types/knowledge_base.rb', line 34 def initialize(name:, provider:, description:, file_ids:, model: OMIT, additional_properties: nil) @name = name @provider = provider @model = model if model != OMIT @description = description @file_ids = file_ids @additional_properties = additional_properties @_field_set = { "name": name, "provider": provider, "model": model, "description": description, "fileIds": file_ids }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
20 21 22 |
# File 'lib/vapi_server_sdk/types/knowledge_base.rb', line 20 def additional_properties @additional_properties end |
#description ⇒ String (readonly)
16 17 18 |
# File 'lib/vapi_server_sdk/types/knowledge_base.rb', line 16 def description @description end |
#file_ids ⇒ Array<String> (readonly)
18 19 20 |
# File 'lib/vapi_server_sdk/types/knowledge_base.rb', line 18 def file_ids @file_ids end |
#model ⇒ Vapi::KnowledgeBaseModel (readonly)
14 15 16 |
# File 'lib/vapi_server_sdk/types/knowledge_base.rb', line 14 def model @model end |
#name ⇒ String (readonly)
10 11 12 |
# File 'lib/vapi_server_sdk/types/knowledge_base.rb', line 10 def name @name end |
#provider ⇒ String (readonly)
12 13 14 |
# File 'lib/vapi_server_sdk/types/knowledge_base.rb', line 12 def provider @provider end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::KnowledgeBase
Deserialize a JSON object to an instance of KnowledgeBase
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/vapi_server_sdk/types/knowledge_base.rb', line 56 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) name = parsed_json["name"] provider = parsed_json["provider"] model = parsed_json["model"] description = parsed_json["description"] file_ids = parsed_json["fileIds"] new( name: name, provider: provider, model: model, description: description, file_ids: file_ids, 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.
87 88 89 90 91 92 93 |
# File 'lib/vapi_server_sdk/types/knowledge_base.rb', line 87 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.provider.is_a?(String) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.") obj.model&.is_a?(Vapi::KnowledgeBaseModel) != false || raise("Passed value for field obj.model is not the expected type, validation failed.") obj.description.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.") obj.file_ids.is_a?(Array) != false || raise("Passed value for field obj.file_ids is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of KnowledgeBase to a JSON object
77 78 79 |
# File 'lib/vapi_server_sdk/types/knowledge_base.rb', line 77 def to_json(*_args) @_field_set&.to_json end |