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.
-
#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.
-
#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, transcript: 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, transcript: OMIT, additional_properties: nil) ⇒ Vapi::Artifact
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 53 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, transcript: 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 @transcript = transcript if transcript != 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, "transcript": transcript }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
31 32 33 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 31 def additional_properties @additional_properties end |
#messages ⇒ Array<Vapi::ArtifactMessagesItem> (readonly)
Returns These are the messages that were spoken during the call.
11 12 13 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 11 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.
13 14 15 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 13 def @messages_open_ai_formatted end |
#recording_url ⇒ String (readonly)
Returns This is the recording url for the call. To enable, set ‘assistant.artifactPlan.recordingEnabled`.
16 17 18 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 16 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`.
19 20 21 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 19 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.
29 30 31 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 29 def transcript @transcript 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.
26 27 28 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 26 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`.
22 23 24 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 22 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
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 82 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"] transcript = parsed_json["transcript"] 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, transcript: transcript, 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.
123 124 125 126 127 128 129 130 131 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 123 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.transcript&.is_a?(String) != false || raise("Passed value for field obj.transcript is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Artifact to a JSON object
113 114 115 |
# File 'lib/vapi_server_sdk/types/artifact.rb', line 113 def to_json(*_args) @_field_set&.to_json end |