Class: Vapi::ClientMessageConversationUpdate
- Inherits:
-
Object
- Object
- Vapi::ClientMessageConversationUpdate
- Defined in:
- lib/vapi_server_sdk/types/client_message_conversation_update.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#messages ⇒ Array<Vapi::ClientMessageConversationUpdateMessagesItem>
readonly
This is the most up-to-date conversation history at the time the message is sent.
-
#messages_open_ai_formatted ⇒ Array<Vapi::OpenAiMessage>
readonly
This is the most up-to-date conversation history at the time the message is sent, formatted for OpenAI.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::ClientMessageConversationUpdate
Deserialize a JSON object to an instance of ClientMessageConversationUpdate.
-
.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(messages_open_ai_formatted:, messages: OMIT, additional_properties: nil) ⇒ Vapi::ClientMessageConversationUpdate constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of ClientMessageConversationUpdate to a JSON object.
Constructor Details
#initialize(messages_open_ai_formatted:, messages: OMIT, additional_properties: nil) ⇒ Vapi::ClientMessageConversationUpdate
30 31 32 33 34 35 36 37 |
# File 'lib/vapi_server_sdk/types/client_message_conversation_update.rb', line 30 def initialize(messages_open_ai_formatted:, messages: OMIT, additional_properties: nil) @messages = if != OMIT @messages_open_ai_formatted = @additional_properties = additional_properties @_field_set = { "messages": , "messagesOpenAIFormatted": }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/vapi_server_sdk/types/client_message_conversation_update.rb', line 17 def additional_properties @additional_properties end |
#messages ⇒ Array<Vapi::ClientMessageConversationUpdateMessagesItem> (readonly)
Returns This is the most up-to-date conversation history at the time the message is sent.
12 13 14 |
# File 'lib/vapi_server_sdk/types/client_message_conversation_update.rb', line 12 def @messages end |
#messages_open_ai_formatted ⇒ Array<Vapi::OpenAiMessage> (readonly)
Returns This is the most up-to-date conversation history at the time the message is sent, formatted for OpenAI.
15 16 17 |
# File 'lib/vapi_server_sdk/types/client_message_conversation_update.rb', line 15 def @messages_open_ai_formatted end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::ClientMessageConversationUpdate
Deserialize a JSON object to an instance of ClientMessageConversationUpdate
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/vapi_server_sdk/types/client_message_conversation_update.rb', line 43 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) = parsed_json["messages"]&.map do |item| item = item.to_json Vapi::ClientMessageConversationUpdateMessagesItem.from_json(json_object: item) end = parsed_json["messagesOpenAIFormatted"]&.map do |item| item = item.to_json Vapi::OpenAiMessage.from_json(json_object: item) end new( messages: , messages_open_ai_formatted: , 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.
74 75 76 77 |
# File 'lib/vapi_server_sdk/types/client_message_conversation_update.rb', line 74 def self.validate_raw(obj:) obj.&.is_a?(Array) != false || raise("Passed value for field obj.messages is not the expected type, validation failed.") obj..is_a?(Array) != false || raise("Passed value for field obj.messages_open_ai_formatted is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of ClientMessageConversationUpdate to a JSON object
64 65 66 |
# File 'lib/vapi_server_sdk/types/client_message_conversation_update.rb', line 64 def to_json(*_args) @_field_set&.to_json end |