Class: Vapi::ServerMessageResponseKnowledgeBaseRequest
- Inherits:
-
Object
- Object
- Vapi::ServerMessageResponseKnowledgeBaseRequest
- Defined in:
- lib/vapi_server_sdk/types/server_message_response_knowledge_base_request.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#documents ⇒ Array<Vapi::KnowledgeBaseResponseDocument>
readonly
This is the list of documents that will be sent to the model alongside the ‘messages` to generate a response.
-
#message ⇒ Vapi::CustomMessage
readonly
This can be used to skip the model output generation and speak a custom message.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ServerMessageResponseKnowledgeBaseRequest
Deserialize a JSON object to an instance of ServerMessageResponseKnowledgeBaseRequest.
-
.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(documents: OMIT, message: OMIT, additional_properties: nil) ⇒ Vapi::ServerMessageResponseKnowledgeBaseRequest constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ServerMessageResponseKnowledgeBaseRequest to a JSON object.
Constructor Details
#initialize(documents: OMIT, message: OMIT, additional_properties: nil) ⇒ Vapi::ServerMessageResponseKnowledgeBaseRequest
28 29 30 31 32 33 34 35 |
# File 'lib/vapi_server_sdk/types/server_message_response_knowledge_base_request.rb', line 28 def initialize(documents: OMIT, message: OMIT, additional_properties: nil) @documents = documents if documents != OMIT @message = if != OMIT @additional_properties = additional_properties @_field_set = { "documents": documents, "message": }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
16 17 18 |
# File 'lib/vapi_server_sdk/types/server_message_response_knowledge_base_request.rb', line 16 def additional_properties @additional_properties end |
#documents ⇒ Array<Vapi::KnowledgeBaseResponseDocument> (readonly)
Returns This is the list of documents that will be sent to the model alongside the ‘messages` to generate a response.
12 13 14 |
# File 'lib/vapi_server_sdk/types/server_message_response_knowledge_base_request.rb', line 12 def documents @documents end |
#message ⇒ Vapi::CustomMessage (readonly)
Returns This can be used to skip the model output generation and speak a custom message.
14 15 16 |
# File 'lib/vapi_server_sdk/types/server_message_response_knowledge_base_request.rb', line 14 def @message end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ServerMessageResponseKnowledgeBaseRequest
Deserialize a JSON object to an instance of
ServerMessageResponseKnowledgeBaseRequest
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/vapi_server_sdk/types/server_message_response_knowledge_base_request.rb', line 42 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) documents = parsed_json["documents"]&.map do |item| item = item.to_json Vapi::KnowledgeBaseResponseDocument.from_json(json_object: item) end if parsed_json["message"].nil? = nil else = parsed_json["message"].to_json = Vapi::CustomMessage.from_json(json_object: ) end new( documents: documents, message: , 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.
76 77 78 79 |
# File 'lib/vapi_server_sdk/types/server_message_response_knowledge_base_request.rb', line 76 def self.validate_raw(obj:) obj.documents&.is_a?(Array) != false || raise("Passed value for field obj.documents is not the expected type, validation failed.") obj..nil? || Vapi::CustomMessage.validate_raw(obj: obj.) end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ServerMessageResponseKnowledgeBaseRequest to a JSON
object
66 67 68 |
# File 'lib/vapi_server_sdk/types/server_message_response_knowledge_base_request.rb', line 66 def to_json(*_args) @_field_set&.to_json end |