Class: Vapi::Artifact
- Inherits:
-
Object
- Object
- Vapi::Artifact
- Defined in:
- lib/vapi_server_sdk/types/artifact.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::ArtifactMessagesItem>
readonly
These are the messages that were spoken during the call.
-
#messages_open_ai_formatted ⇒ Array<Vapi::OpenAiMessage>
readonly
These are the messages that were spoken during the call, formatted for OpenAI.
-
#nodes ⇒ Array<Vapi::NodeArtifact>
readonly
This is the history of workflow nodes that were executed during the call.
-
#pcap_url ⇒ String
readonly
This is the packet capture url for the call.
-
#recording ⇒ Vapi::Recording
readonly
This is the recording url for the call.
-
#recording_url ⇒ String
readonly
This is the recording url for the call.
-
#stereo_recording_url ⇒ String
readonly
This is the stereo recording url for the call.
-
#transcript ⇒ String
readonly
This is the transcript of the call.
-
#variable_values ⇒ Hash{String => Object}
readonly
These are the variable values at the end of the workflow execution.
-
#video_recording_start_delay_seconds ⇒ Float
readonly
This is video recording start delay in ms.
-
#video_recording_url ⇒ String
readonly
This is video recording url for the call.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::Artifact
Deserialize a JSON object to an instance of Artifact.
-
.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: OMIT, messages_open_ai_formatted: OMIT, recording_url: OMIT, stereo_recording_url: OMIT, video_recording_url: OMIT, video_recording_start_delay_seconds: OMIT, recording: OMIT, transcript: OMIT, pcap_url: OMIT, nodes: OMIT, variable_values: OMIT, additional_properties: nil) ⇒ Vapi::Artifact constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Artifact to a JSON object.
Constructor Details
#initialize(messages: OMIT, messages_open_ai_formatted: OMIT, recording_url: OMIT, stereo_recording_url: OMIT, video_recording_url: OMIT, video_recording_start_delay_seconds: OMIT, recording: OMIT, transcript: OMIT, pcap_url: OMIT, nodes: OMIT, variable_values: OMIT, additional_properties: nil) ⇒ Vapi::Artifact
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 71 def initialize(messages: OMIT, messages_open_ai_formatted: OMIT, recording_url: OMIT, stereo_recording_url: OMIT, video_recording_url: OMIT, video_recording_start_delay_seconds: OMIT, recording: OMIT, transcript: OMIT, pcap_url: OMIT, nodes: OMIT, variable_values: OMIT, additional_properties: nil) @messages = if != OMIT @messages_open_ai_formatted = if != OMIT @recording_url = recording_url if recording_url != OMIT @stereo_recording_url = stereo_recording_url if stereo_recording_url != OMIT @video_recording_url = video_recording_url if video_recording_url != OMIT if video_recording_start_delay_seconds != OMIT @video_recording_start_delay_seconds = video_recording_start_delay_seconds end @recording = recording if recording != OMIT @transcript = transcript if transcript != OMIT @pcap_url = pcap_url if pcap_url != OMIT @nodes = nodes if nodes != OMIT @variable_values = variable_values if variable_values != OMIT @additional_properties = additional_properties @_field_set = { "messages": , "messagesOpenAIFormatted": , "recordingUrl": recording_url, "stereoRecordingUrl": stereo_recording_url, "videoRecordingUrl": video_recording_url, "videoRecordingStartDelaySeconds": video_recording_start_delay_seconds, "recording": recording, "transcript": transcript, "pcapUrl": pcap_url, "nodes": nodes, "variableValues": variable_values }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
43 44 45 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 43 def additional_properties @additional_properties end |
#messages ⇒ Array<Vapi::ArtifactMessagesItem> (readonly)
Returns These are the messages that were spoken during the call.
13 14 15 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 13 def @messages end |
#messages_open_ai_formatted ⇒ Array<Vapi::OpenAiMessage> (readonly)
Returns These are the messages that were spoken during the call, formatted for OpenAI.
15 16 17 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 15 def @messages_open_ai_formatted end |
#nodes ⇒ Array<Vapi::NodeArtifact> (readonly)
Returns This is the history of workflow nodes that were executed during the call.
39 40 41 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 39 def nodes @nodes end |
#pcap_url ⇒ String (readonly)
Returns This is the packet capture url for the call. This is only available for ‘phone` type calls where phone number’s provider is ‘vapi` or `byo-phone-number`.
37 38 39 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 37 def pcap_url @pcap_url end |
#recording ⇒ Vapi::Recording (readonly)
Returns This is the recording url for the call. To enable, set ‘assistant.artifactPlan.recordingEnabled`.
31 32 33 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 31 def recording @recording end |
#recording_url ⇒ String (readonly)
Returns This is the recording url for the call. To enable, set ‘assistant.artifactPlan.recordingEnabled`.
18 19 20 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 18 def recording_url @recording_url end |
#stereo_recording_url ⇒ String (readonly)
Returns This is the stereo recording url for the call. To enable, set ‘assistant.artifactPlan.recordingEnabled`.
21 22 23 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 21 def stereo_recording_url @stereo_recording_url end |
#transcript ⇒ String (readonly)
Returns This is the transcript of the call. This is derived from ‘artifact.messages` but provided for convenience.
34 35 36 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 34 def transcript @transcript end |
#variable_values ⇒ Hash{String => Object} (readonly)
Returns These are the variable values at the end of the workflow execution.
41 42 43 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 41 def variable_values @variable_values end |
#video_recording_start_delay_seconds ⇒ Float (readonly)
Returns This is video recording start delay in ms. To enable, set ‘assistant.artifactPlan.videoRecordingEnabled`. This can be used to align the playback of the recording with artifact.messages timestamps.
28 29 30 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 28 def video_recording_start_delay_seconds @video_recording_start_delay_seconds end |
#video_recording_url ⇒ String (readonly)
Returns This is video recording url for the call. To enable, set ‘assistant.artifactPlan.videoRecordingEnabled`.
24 25 26 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 24 def video_recording_url @video_recording_url end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::Artifact
Deserialize a JSON object to an instance of Artifact
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 108 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::ArtifactMessagesItem.from_json(json_object: item) end = parsed_json["messagesOpenAIFormatted"]&.map do |item| item = item.to_json Vapi::OpenAiMessage.from_json(json_object: item) end recording_url = parsed_json["recordingUrl"] stereo_recording_url = parsed_json["stereoRecordingUrl"] video_recording_url = parsed_json["videoRecordingUrl"] video_recording_start_delay_seconds = parsed_json["videoRecordingStartDelaySeconds"] if parsed_json["recording"].nil? recording = nil else recording = parsed_json["recording"].to_json recording = Vapi::Recording.from_json(json_object: recording) end transcript = parsed_json["transcript"] pcap_url = parsed_json["pcapUrl"] nodes = parsed_json["nodes"]&.map do |item| item = item.to_json Vapi::NodeArtifact.from_json(json_object: item) end variable_values = parsed_json["variableValues"] new( messages: , messages_open_ai_formatted: , recording_url: recording_url, stereo_recording_url: stereo_recording_url, video_recording_url: video_recording_url, video_recording_start_delay_seconds: video_recording_start_delay_seconds, recording: recording, transcript: transcript, pcap_url: pcap_url, nodes: nodes, variable_values: variable_values, 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.
165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 165 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.") obj.recording_url&.is_a?(String) != false || raise("Passed value for field obj.recording_url is not the expected type, validation failed.") obj.stereo_recording_url&.is_a?(String) != false || raise("Passed value for field obj.stereo_recording_url is not the expected type, validation failed.") obj.video_recording_url&.is_a?(String) != false || raise("Passed value for field obj.video_recording_url is not the expected type, validation failed.") obj.video_recording_start_delay_seconds&.is_a?(Float) != false || raise("Passed value for field obj.video_recording_start_delay_seconds is not the expected type, validation failed.") obj.recording.nil? || Vapi::Recording.validate_raw(obj: obj.recording) obj.transcript&.is_a?(String) != false || raise("Passed value for field obj.transcript is not the expected type, validation failed.") obj.pcap_url&.is_a?(String) != false || raise("Passed value for field obj.pcap_url is not the expected type, validation failed.") obj.nodes&.is_a?(Array) != false || raise("Passed value for field obj.nodes is not the expected type, validation failed.") obj.variable_values&.is_a?(Hash) != false || raise("Passed value for field obj.variable_values is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Artifact to a JSON object
155 156 157 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 155 def to_json(*_args) @_field_set&.to_json end |