vapi_client/models/model_based_condition.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::ToSchema;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, ToSchema)]
18pub struct ModelBasedCondition {
19 /// This condition is based on a model.
20 #[serde(rename = "type")]
21 pub r#type: Type,
22 /// This is the instruction which should output a boolean value when passed to a model. You can reference any variable in the context of the current block execution (step): - \"{{output.your-property-name}}\" for current step's output - \"{{input.your-property-name}}\" for current step's input - \"{{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 You can also talk about the current step's output or input directly: - \"{{output.your-property-name}} is greater than 10\" - \"{{input.your-property-name}} is greater than 10\" Examples: - \"{{input.age}} is greater than 10\" - \"{{input.age}} is greater than {{input.age2}}\" - \"{{output.age}} is greater than 10\" 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 with steps.
23 #[serde(rename = "instruction")]
24 pub instruction: String,
25}
26
27impl ModelBasedCondition {
28 pub fn new(r#type: Type, instruction: String) -> ModelBasedCondition {
29 ModelBasedCondition {
30 r#type,
31 instruction,
32 }
33 }
34}
35/// This condition is based on a model.
36#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, ToSchema)]
37pub enum Type {
38 #[serde(rename = "model-based")]
39 ModelBased,
40}
41
42impl Default for Type {
43 fn default() -> Type {
44 Self::ModelBased
45 }
46}