Class: Vapi::CreateChatStreamResponse
- Inherits:
-
Object
- Object
- Vapi::CreateChatStreamResponse
- Defined in:
- lib/vapi_server_sdk/types/create_chat_stream_response.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#delta ⇒ String
readonly
This is the incremental content chunk being streamed.
-
#id ⇒ String
readonly
This is the unique identifier for the streaming response.
-
#path ⇒ String
readonly
This is the path to the content being updated.
-
#session_id ⇒ String
readonly
This is the ID of the session that will be used for the chat.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::CreateChatStreamResponse
Deserialize a JSON object to an instance of CreateChatStreamResponse.
-
.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:, path:, delta:, session_id: OMIT, additional_properties: nil) ⇒ Vapi::CreateChatStreamResponse constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of CreateChatStreamResponse to a JSON object.
Constructor Details
#initialize(id:, path:, delta:, session_id: OMIT, additional_properties: nil) ⇒ Vapi::CreateChatStreamResponse
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/vapi_server_sdk/types/create_chat_stream_response.rb', line 36 def initialize(id:, path:, delta:, session_id: OMIT, additional_properties: nil) @id = id @session_id = session_id if session_id != OMIT @path = path @delta = delta @additional_properties = additional_properties @_field_set = { "id": id, "sessionId": session_id, "path": path, "delta": delta }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
20 21 22 |
# File 'lib/vapi_server_sdk/types/create_chat_stream_response.rb', line 20 def additional_properties @additional_properties end |
#delta ⇒ String (readonly)
Returns This is the incremental content chunk being streamed.
18 19 20 |
# File 'lib/vapi_server_sdk/types/create_chat_stream_response.rb', line 18 def delta @delta end |
#id ⇒ String (readonly)
Returns This is the unique identifier for the streaming response.
9 10 11 |
# File 'lib/vapi_server_sdk/types/create_chat_stream_response.rb', line 9 def id @id end |
#path ⇒ String (readonly)
Returns This is the path to the content being updated. Format: ‘chat.output.content` where contentIndex identifies the specific content item.
16 17 18 |
# File 'lib/vapi_server_sdk/types/create_chat_stream_response.rb', line 16 def path @path end |
#session_id ⇒ String (readonly)
Returns This is the ID of the session that will be used for the chat. Helps track conversation context across multiple messages.
12 13 14 |
# File 'lib/vapi_server_sdk/types/create_chat_stream_response.rb', line 12 def session_id @session_id end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::CreateChatStreamResponse
Deserialize a JSON object to an instance of CreateChatStreamResponse
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/vapi_server_sdk/types/create_chat_stream_response.rb', line 51 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] session_id = parsed_json["sessionId"] path = parsed_json["path"] delta = parsed_json["delta"] new( id: id, session_id: session_id, path: path, delta: delta, 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.
80 81 82 83 84 85 |
# File 'lib/vapi_server_sdk/types/create_chat_stream_response.rb', line 80 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.session_id&.is_a?(String) != false || raise("Passed value for field obj.session_id is not the expected type, validation failed.") obj.path.is_a?(String) != false || raise("Passed value for field obj.path is not the expected type, validation failed.") obj.delta.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of CreateChatStreamResponse to a JSON object
70 71 72 |
# File 'lib/vapi_server_sdk/types/create_chat_stream_response.rb', line 70 def to_json(*_args) @_field_set&.to_json end |