vapi_client/models/
handoff_step.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12use utoipa::OpenApi;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, OpenApi)]
18pub struct HandoffStep {
19    #[serde(rename = "block", skip_serializing_if = "Option::is_none")]
20    pub block: Option<models::HandoffStepBlock>,
21    /// This is a step that takes a handoff from the previous step. This means it won't return to the calling step. The workflow execution will continue linearly.  Use case: - You want to collect information linearly (e.g. a form, provide information, etc).
22    #[serde(rename = "type")]
23    pub r#type: Type,
24    /// These are the destinations that the step can go to after it's done.
25    #[serde(rename = "destinations", skip_serializing_if = "Option::is_none")]
26    pub destinations: Option<Vec<models::HandoffStepDestinationsInner>>,
27    /// This is the name of the step.
28    #[serde(rename = "name")]
29    pub name: String,
30    /// This is the id of the block to use. To use a transient block, use `block`.
31    #[serde(rename = "blockId", skip_serializing_if = "Option::is_none")]
32    pub block_id: Option<String>,
33    /// This is the input to the block. You can use any key-value map as input to the block.  Example: {   \"name\": \"John Doe\",   \"age\": 20 }  You can reference any variable in the context of the current block: - \"{{your-step-name.output.your-property-name}}\" for another step's output (in the same workflow; read caveat #1) - \"{{your-step-name.input.your-property-name}}\" for another step's input (in the same workflow; read caveat #1) - \"{{your-block-name.output.your-property-name}}\" for another block's output (in the same workflow; read caveat #2) - \"{{your-block-name.input.your-property-name}}\" for another block's input (in the same workflow; read caveat #2) - \"{{workflow.input.your-property-name}}\" for the current workflow's input - \"{{global.your-property-name}}\" for the global context  Example: {   \"name\": \"{{my-tool-call-step.output.name}}\",   \"age\": \"{{my-tool-call-step.input.age}}\",   \"date\": \"{{workflow.input.date}}\" }  You can dynamically change the key name.  Example: {   \"{{my-tool-call-step.output.key-name-for-name}}\": \"{{name}}\",   \"{{my-tool-call-step.input.key-name-for-age}}\": \"{{age}}\",   \"{{workflow.input.key-name-for-date}}\": \"{{date}}\" }  You can represent the value as a string, number, boolean, array, or object.  Example: {   \"name\": \"john\",   \"age\": 20,   \"date\": \"2021-01-01\",   \"metadata\": {     \"unique-key\": \"{{my-tool-call-step.output.unique-key}}\"   },   \"array\": [\"A\", \"B\", \"C\"], }  Caveats: 1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step. 2. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow.
34    #[serde(rename = "input", skip_serializing_if = "Option::is_none")]
35    pub input: Option<serde_json::Value>,
36}
37
38impl HandoffStep {
39    pub fn new(r#type: Type, name: String) -> HandoffStep {
40        HandoffStep {
41            block: None,
42            r#type,
43            destinations: None,
44            name,
45            block_id: None,
46            input: None,
47        }
48    }
49}
50/// This is a step that takes a handoff from the previous step. This means it won't return to the calling step. The workflow execution will continue linearly.  Use case: - You want to collect information linearly (e.g. a form, provide information, etc).
51#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, OpenApi)]
52pub enum Type {
53    #[serde(rename = "handoff")]
54    Handoff,
55}
56
57impl Default for Type {
58    fn default() -> Type {
59        Self::Handoff
60    }
61}