Class: Vapi::KnowledgeBaseResponseDocument
- Inherits:
-
Object
- Object
- Vapi::KnowledgeBaseResponseDocument
- Defined in:
- lib/vapi_server_sdk/types/knowledge_base_response_document.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#content ⇒ String
readonly
This is the content of the document.
-
#similarity ⇒ Float
readonly
This is the similarity score of the document.
-
#uuid ⇒ String
readonly
This is the uuid of the document.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::KnowledgeBaseResponseDocument
Deserialize a JSON object to an instance of KnowledgeBaseResponseDocument.
-
.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(content:, similarity:, uuid: OMIT, additional_properties: nil) ⇒ Vapi::KnowledgeBaseResponseDocument constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of KnowledgeBaseResponseDocument to a JSON object.
Constructor Details
#initialize(content:, similarity:, uuid: OMIT, additional_properties: nil) ⇒ Vapi::KnowledgeBaseResponseDocument
27 28 29 30 31 32 33 34 35 |
# File 'lib/vapi_server_sdk/types/knowledge_base_response_document.rb', line 27 def initialize(content:, similarity:, uuid: OMIT, additional_properties: nil) @content = content @similarity = similarity @uuid = uuid if uuid != OMIT @additional_properties = additional_properties @_field_set = { "content": content, "similarity": similarity, "uuid": uuid }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/vapi_server_sdk/types/knowledge_base_response_document.rb', line 15 def additional_properties @additional_properties end |
#content ⇒ String (readonly)
Returns This is the content of the document.
9 10 11 |
# File 'lib/vapi_server_sdk/types/knowledge_base_response_document.rb', line 9 def content @content end |
#similarity ⇒ Float (readonly)
Returns This is the similarity score of the document.
11 12 13 |
# File 'lib/vapi_server_sdk/types/knowledge_base_response_document.rb', line 11 def similarity @similarity end |
#uuid ⇒ String (readonly)
Returns This is the uuid of the document.
13 14 15 |
# File 'lib/vapi_server_sdk/types/knowledge_base_response_document.rb', line 13 def uuid @uuid end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::KnowledgeBaseResponseDocument
Deserialize a JSON object to an instance of KnowledgeBaseResponseDocument
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/vapi_server_sdk/types/knowledge_base_response_document.rb', line 41 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) content = parsed_json["content"] similarity = parsed_json["similarity"] uuid = parsed_json["uuid"] new( content: content, similarity: similarity, uuid: uuid, 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.
68 69 70 71 72 |
# File 'lib/vapi_server_sdk/types/knowledge_base_response_document.rb', line 68 def self.validate_raw(obj:) obj.content.is_a?(String) != false || raise("Passed value for field obj.content is not the expected type, validation failed.") obj.similarity.is_a?(Float) != false || raise("Passed value for field obj.similarity is not the expected type, validation failed.") obj.uuid&.is_a?(String) != false || raise("Passed value for field obj.uuid is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of KnowledgeBaseResponseDocument to a JSON object
58 59 60 |
# File 'lib/vapi_server_sdk/types/knowledge_base_response_document.rb', line 58 def to_json(*_args) @_field_set&.to_json end |