Class: Vapi::Workflow
- Inherits:
-
Object
- Object
- Vapi::Workflow
- Defined in:
- lib/vapi_server_sdk/types/workflow.rb,
lib/vapi_server_sdk/workflow/types/update_workflow_dto_voice.rb,
lib/vapi_server_sdk/workflow/types/update_workflow_dto_nodes_item.rb,
lib/vapi_server_sdk/workflow/types/update_workflow_dto_transcriber.rb,
lib/vapi_server_sdk/workflow/types/update_workflow_dto_background_sound.rb,
lib/vapi_server_sdk/workflow/types/update_workflow_dto_credentials_item.rb,
lib/vapi_server_sdk/workflow/types/update_workflow_dto_background_sound_zero.rb
Defined Under Namespace
Classes: UpdateWorkflowDtoBackgroundSound, UpdateWorkflowDtoBackgroundSoundZero, UpdateWorkflowDtoCredentialsItem, UpdateWorkflowDtoNodesItem, UpdateWorkflowDtoTranscriber, UpdateWorkflowDtoVoice
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#analysis_plan ⇒ Vapi::AnalysisPlan
readonly
This is the plan for analysis of workflow’s calls.
-
#artifact_plan ⇒ Vapi::ArtifactPlan
readonly
This is the plan for artifacts generated during workflow’s calls.
-
#background_sound ⇒ Vapi::WorkflowBackgroundSound
readonly
This is the background sound in the call.
-
#background_speech_denoising_plan ⇒ Vapi::BackgroundSpeechDenoisingPlan
readonly
This enables filtering of noise and background speech while the user is talking.
-
#compliance_plan ⇒ Vapi::CompliancePlan
readonly
This is the compliance plan for the workflow.
- #created_at ⇒ DateTime readonly
-
#credential_ids ⇒ Array<String>
readonly
These are the credentials that will be used for the workflow calls.
-
#credentials ⇒ Array<Vapi::WorkflowCredentialsItem>
readonly
These are dynamic credentials that will be used for the workflow calls.
- #edges ⇒ Array<Vapi::Edge> readonly
- #global_prompt ⇒ String readonly
- #id ⇒ String readonly
-
#monitor_plan ⇒ Vapi::MonitorPlan
readonly
This is the plan for real-time monitoring of the workflow’s calls.
- #name ⇒ String readonly
- #nodes ⇒ Array<Vapi::WorkflowNodesItem> readonly
-
#observability_plan ⇒ Vapi::LangfuseObservabilityPlan
readonly
This is the plan for observability of workflow’s calls.
- #org_id ⇒ String readonly
-
#server ⇒ Vapi::Server
readonly
This is where Vapi will send webhooks.
-
#start_speaking_plan ⇒ Vapi::StartSpeakingPlan
readonly
This is the plan for when the workflow nodes should start talking.
-
#stop_speaking_plan ⇒ Vapi::StopSpeakingPlan
readonly
This is the plan for when workflow nodes should stop talking on customer interruption.
-
#transcriber ⇒ Vapi::WorkflowTranscriber
readonly
This is the transcriber for the workflow.
- #updated_at ⇒ DateTime readonly
-
#voice ⇒ Vapi::WorkflowVoice
readonly
This is the voice for the workflow.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Vapi::Workflow
Deserialize a JSON object to an instance of Workflow.
-
.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(nodes:, id:, org_id:, created_at:, updated_at:, name:, edges:, transcriber: OMIT, voice: OMIT, observability_plan: OMIT, background_sound: OMIT, credentials: OMIT, global_prompt: OMIT, server: OMIT, compliance_plan: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, background_speech_denoising_plan: OMIT, credential_ids: OMIT, additional_properties: nil) ⇒ Vapi::Workflow constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Workflow to a JSON object.
Constructor Details
#initialize(nodes:, id:, org_id:, created_at:, updated_at:, name:, edges:, transcriber: OMIT, voice: OMIT, observability_plan: OMIT, background_sound: OMIT, credentials: OMIT, global_prompt: OMIT, server: OMIT, compliance_plan: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, background_speech_denoising_plan: OMIT, credential_ids: OMIT, additional_properties: nil) ⇒ Vapi::Workflow
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 186 def initialize(nodes:, id:, org_id:, created_at:, updated_at:, name:, edges:, transcriber: OMIT, voice: OMIT, observability_plan: OMIT, background_sound: OMIT, credentials: OMIT, global_prompt: OMIT, server: OMIT, compliance_plan: OMIT, analysis_plan: OMIT, artifact_plan: OMIT, start_speaking_plan: OMIT, stop_speaking_plan: OMIT, monitor_plan: OMIT, background_speech_denoising_plan: OMIT, credential_ids: OMIT, additional_properties: nil) @nodes = nodes @transcriber = transcriber if transcriber != OMIT @voice = voice if voice != OMIT @observability_plan = observability_plan if observability_plan != OMIT @background_sound = background_sound if background_sound != OMIT @credentials = credentials if credentials != OMIT @id = id @org_id = org_id @created_at = created_at @updated_at = updated_at @name = name @edges = edges @global_prompt = global_prompt if global_prompt != OMIT @server = server if server != OMIT @compliance_plan = compliance_plan if compliance_plan != OMIT @analysis_plan = analysis_plan if analysis_plan != OMIT @artifact_plan = artifact_plan if artifact_plan != OMIT @start_speaking_plan = start_speaking_plan if start_speaking_plan != OMIT @stop_speaking_plan = stop_speaking_plan if stop_speaking_plan != OMIT @monitor_plan = monitor_plan if monitor_plan != OMIT @background_speech_denoising_plan = background_speech_denoising_plan if background_speech_denoising_plan != OMIT @credential_ids = credential_ids if credential_ids != OMIT @additional_properties = additional_properties @_field_set = { "nodes": nodes, "transcriber": transcriber, "voice": voice, "observabilityPlan": observability_plan, "backgroundSound": background_sound, "credentials": credentials, "id": id, "orgId": org_id, "createdAt": created_at, "updatedAt": updated_at, "name": name, "edges": edges, "globalPrompt": global_prompt, "server": server, "compliancePlan": compliance_plan, "analysisPlan": analysis_plan, "artifactPlan": artifact_plan, "startSpeakingPlan": start_speaking_plan, "stopSpeakingPlan": stop_speaking_plan, "monitorPlan": monitor_plan, "backgroundSpeechDenoisingPlan": background_speech_denoising_plan, "credentialIds": credential_ids }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
112 113 114 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 112 def additional_properties @additional_properties end |
#analysis_plan ⇒ Vapi::AnalysisPlan (readonly)
70 71 72 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 70 def analysis_plan @analysis_plan end |
#artifact_plan ⇒ Vapi::ArtifactPlan (readonly)
73 74 75 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 73 def artifact_plan @artifact_plan end |
#background_sound ⇒ Vapi::WorkflowBackgroundSound (readonly)
38 39 40 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 38 def background_sound @background_sound end |
#background_speech_denoising_plan ⇒ Vapi::BackgroundSpeechDenoisingPlan (readonly)
106 107 108 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 106 def background_speech_denoising_plan @background_speech_denoising_plan end |
#compliance_plan ⇒ Vapi::CompliancePlan (readonly)
68 69 70 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 68 def compliance_plan @compliance_plan end |
#created_at ⇒ DateTime (readonly)
49 50 51 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 49 def created_at @created_at end |
#credential_ids ⇒ Array<String> (readonly)
110 111 112 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 110 def credential_ids @credential_ids end |
#credentials ⇒ Array<Vapi::WorkflowCredentialsItem> (readonly)
43 44 45 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 43 def credentials @credentials end |
#edges ⇒ Array<Vapi::Edge> (readonly)
55 56 57 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 55 def edges @edges end |
#global_prompt ⇒ String (readonly)
57 58 59 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 57 def global_prompt @global_prompt end |
#id ⇒ String (readonly)
45 46 47 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 45 def id @id end |
#monitor_plan ⇒ Vapi::MonitorPlan (readonly)
98 99 100 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 98 def monitor_plan @monitor_plan end |
#name ⇒ String (readonly)
53 54 55 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 53 def name @name end |
#nodes ⇒ Array<Vapi::WorkflowNodesItem> (readonly)
25 26 27 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 25 def nodes @nodes end |
#observability_plan ⇒ Vapi::LangfuseObservabilityPlan (readonly)
34 35 36 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 34 def observability_plan @observability_plan end |
#org_id ⇒ String (readonly)
47 48 49 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 47 def org_id @org_id end |
#server ⇒ Vapi::Server (readonly)
65 66 67 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 65 def server @server end |
#start_speaking_plan ⇒ Vapi::StartSpeakingPlan (readonly)
81 82 83 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 81 def start_speaking_plan @start_speaking_plan end |
#stop_speaking_plan ⇒ Vapi::StopSpeakingPlan (readonly)
91 92 93 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 91 def stop_speaking_plan @stop_speaking_plan end |
#transcriber ⇒ Vapi::WorkflowTranscriber (readonly)
28 29 30 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 28 def transcriber @transcriber end |
#updated_at ⇒ DateTime (readonly)
51 52 53 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 51 def updated_at @updated_at end |
#voice ⇒ Vapi::WorkflowVoice (readonly)
31 32 33 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 31 def voice @voice end |
Class Method Details
.from_json(json_object:) ⇒ Vapi::Workflow
Deserialize a JSON object to an instance of Workflow
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 243 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) nodes = parsed_json["nodes"]&.map do |item| item = item.to_json Vapi::WorkflowNodesItem.from_json(json_object: item) end if parsed_json["transcriber"].nil? transcriber = nil else transcriber = parsed_json["transcriber"].to_json transcriber = Vapi::WorkflowTranscriber.from_json(json_object: transcriber) end if parsed_json["voice"].nil? voice = nil else voice = parsed_json["voice"].to_json voice = Vapi::WorkflowVoice.from_json(json_object: voice) end if parsed_json["observabilityPlan"].nil? observability_plan = nil else observability_plan = parsed_json["observabilityPlan"].to_json observability_plan = Vapi::LangfuseObservabilityPlan.from_json(json_object: observability_plan) end if parsed_json["backgroundSound"].nil? background_sound = nil else background_sound = parsed_json["backgroundSound"].to_json background_sound = Vapi::WorkflowBackgroundSound.from_json(json_object: background_sound) end credentials = parsed_json["credentials"]&.map do |item| item = item.to_json Vapi::WorkflowCredentialsItem.from_json(json_object: item) end id = parsed_json["id"] org_id = parsed_json["orgId"] created_at = (DateTime.parse(parsed_json["createdAt"]) unless parsed_json["createdAt"].nil?) updated_at = (DateTime.parse(parsed_json["updatedAt"]) unless parsed_json["updatedAt"].nil?) name = parsed_json["name"] edges = parsed_json["edges"]&.map do |item| item = item.to_json Vapi::Edge.from_json(json_object: item) end global_prompt = parsed_json["globalPrompt"] if parsed_json["server"].nil? server = nil else server = parsed_json["server"].to_json server = Vapi::Server.from_json(json_object: server) end if parsed_json["compliancePlan"].nil? compliance_plan = nil else compliance_plan = parsed_json["compliancePlan"].to_json compliance_plan = Vapi::CompliancePlan.from_json(json_object: compliance_plan) end if parsed_json["analysisPlan"].nil? analysis_plan = nil else analysis_plan = parsed_json["analysisPlan"].to_json analysis_plan = Vapi::AnalysisPlan.from_json(json_object: analysis_plan) end if parsed_json["artifactPlan"].nil? artifact_plan = nil else artifact_plan = parsed_json["artifactPlan"].to_json artifact_plan = Vapi::ArtifactPlan.from_json(json_object: artifact_plan) end if parsed_json["startSpeakingPlan"].nil? start_speaking_plan = nil else start_speaking_plan = parsed_json["startSpeakingPlan"].to_json start_speaking_plan = Vapi::StartSpeakingPlan.from_json(json_object: start_speaking_plan) end if parsed_json["stopSpeakingPlan"].nil? stop_speaking_plan = nil else stop_speaking_plan = parsed_json["stopSpeakingPlan"].to_json stop_speaking_plan = Vapi::StopSpeakingPlan.from_json(json_object: stop_speaking_plan) end if parsed_json["monitorPlan"].nil? monitor_plan = nil else monitor_plan = parsed_json["monitorPlan"].to_json monitor_plan = Vapi::MonitorPlan.from_json(json_object: monitor_plan) end if parsed_json["backgroundSpeechDenoisingPlan"].nil? background_speech_denoising_plan = nil else background_speech_denoising_plan = parsed_json["backgroundSpeechDenoisingPlan"].to_json background_speech_denoising_plan = Vapi::BackgroundSpeechDenoisingPlan.from_json(json_object: background_speech_denoising_plan) end credential_ids = parsed_json["credentialIds"] new( nodes: nodes, transcriber: transcriber, voice: voice, observability_plan: observability_plan, background_sound: background_sound, credentials: credentials, id: id, org_id: org_id, created_at: created_at, updated_at: updated_at, name: name, edges: edges, global_prompt: global_prompt, server: server, compliance_plan: compliance_plan, analysis_plan: analysis_plan, artifact_plan: artifact_plan, start_speaking_plan: start_speaking_plan, stop_speaking_plan: stop_speaking_plan, monitor_plan: monitor_plan, background_speech_denoising_plan: background_speech_denoising_plan, credential_ids: credential_ids, 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.
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 377 def self.validate_raw(obj:) obj.nodes.is_a?(Array) != false || raise("Passed value for field obj.nodes is not the expected type, validation failed.") obj.transcriber.nil? || Vapi::WorkflowTranscriber.validate_raw(obj: obj.transcriber) obj.voice.nil? || Vapi::WorkflowVoice.validate_raw(obj: obj.voice) obj.observability_plan.nil? || Vapi::LangfuseObservabilityPlan.validate_raw(obj: obj.observability_plan) obj.background_sound.nil? || Vapi::WorkflowBackgroundSound.validate_raw(obj: obj.background_sound) obj.credentials&.is_a?(Array) != false || raise("Passed value for field obj.credentials is not the expected type, validation failed.") obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.org_id.is_a?(String) != false || raise("Passed value for field obj.org_id is not the expected type, validation failed.") obj.created_at.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.updated_at.is_a?(DateTime) != false || raise("Passed value for field obj.updated_at is not the expected type, validation failed.") obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.edges.is_a?(Array) != false || raise("Passed value for field obj.edges is not the expected type, validation failed.") obj.global_prompt&.is_a?(String) != false || raise("Passed value for field obj.global_prompt is not the expected type, validation failed.") obj.server.nil? || Vapi::Server.validate_raw(obj: obj.server) obj.compliance_plan.nil? || Vapi::CompliancePlan.validate_raw(obj: obj.compliance_plan) obj.analysis_plan.nil? || Vapi::AnalysisPlan.validate_raw(obj: obj.analysis_plan) obj.artifact_plan.nil? || Vapi::ArtifactPlan.validate_raw(obj: obj.artifact_plan) obj.start_speaking_plan.nil? || Vapi::StartSpeakingPlan.validate_raw(obj: obj.start_speaking_plan) obj.stop_speaking_plan.nil? || Vapi::StopSpeakingPlan.validate_raw(obj: obj.stop_speaking_plan) obj.monitor_plan.nil? || Vapi::MonitorPlan.validate_raw(obj: obj.monitor_plan) obj.background_speech_denoising_plan.nil? || Vapi::BackgroundSpeechDenoisingPlan.validate_raw(obj: obj.background_speech_denoising_plan) obj.credential_ids&.is_a?(Array) != false || raise("Passed value for field obj.credential_ids is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Workflow to a JSON object
367 368 369 |
# File 'lib/vapi_server_sdk/types/workflow.rb', line 367 def to_json(*_args) @_field_set&.to_json end |