pub struct CallbackStep {
pub block: Option<HandoffStepBlock>,
pub type: Type,
pub mutations: Option<Vec<CallbackStepMutationsInner>>,
pub name: String,
pub block_id: Option<String>,
pub input: Option<Value>,
}Fields§
§block: Option<HandoffStepBlock>§type: TypeThis is a step that calls back to the previous step after it’s done. This effectively means we’re spawning a new conversation thread. The previous conversation thread will resume where it left off once this step is done. Use case: - You are collecting a customer’s order and while they were on one item, they start a new item or try to modify a previous one. You would make a OrderUpdate block which calls the same block repeatedly when a new update starts.
mutations: Option<Vec<CallbackStepMutationsInner>>This is the mutations to apply to the context after the step is done.
name: StringThis is the name of the step.
block_id: Option<String>This is the id of the block to use. To use a transient block, use block.
input: Option<Value>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.
Implementations§
Source§impl CallbackStep
impl CallbackStep
pub fn new(type: Type, name: String) -> CallbackStep
Trait Implementations§
Source§impl Clone for CallbackStep
impl Clone for CallbackStep
Source§fn clone(&self) -> CallbackStep
fn clone(&self) -> CallbackStep
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more