shoe-printsSteps

gllm-pipelinearrow-up-right | Tutorial: Steps| Use Case: Build End-to-End RAG Pipeline| API Referencearrow-up-right

What's a Step?

A step is a unit of work (a node) that:

  1. Reads specific keys from the pipeline state (and optionally runtime config).

  2. Performs an operation (component call, function, branching, etc.).

  3. Writes outputs back to the state under specific keys.

You can learn more about composing steps into a pipeline using The Pipe Operator.

Learn in greater detail about input maps in Input Mapping.

chevron-rightPrerequisiteshashtag

This example specifically requires completion of all setup steps listed on the Prerequisites page.

You should be familiar with these concepts:

Installation

# you can use a Conda environment
pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/ "gllm-pipeline"

Basic Steps

We will first learn the basic steps that can be used to create a Pipeline.

Throughout this tutorial page, we will be using the Echo component below as a replacement for our SDK components.

step

A step wraps and runs a Component of our SDK with mapped inputs and stores outputs under a state key.

circle-info

When a step calls a Component, use input_map to map the component’s parameter names to keys in your pipeline state. This tells the step where to read each argument.

Learn more about input maps: Input Mapping.

transform

A transform step applies a callable to selected state keys and writes the result.

bundle

A bundle step collects multiple state keys into a dictionary without changes to their values.

Branching

if_else

An if_else step chooses between two branches based on a condition (a callable or a Component). The condition result can be saved to state.

The condition could also be a Component. In this case, you need to pass an input_map .

switch

A switch step selects a branch from a dict of options based on a condition output (string). Supports default branch.

toggle

A toggle step runs its if_branch if condition is true; otherwise behaves like no_op. Condition can be callable, Component, or a string key looked up in merged state/config.

This step is useful to enable "optional" steps that are decided at runtime.

Concurrency

parallel

A parallel step runs multiple branches in parallel and merges results. Each branch can be a step or a list of steps.

map_reduce

A map_reduce step maps a function (or Component) over multiple items, then reduces results.

Flow Control

no_op

A no_op step is a step that does nothing. This is useful as a placeholder step, or as part of a toggle.

terminate

A terminate step explicitly terminates the current Pipeline. This is useful as part of a guard step.

guard

A guard step evaluates a condition. On success runs success_branch. On failure runs failure_branch, then terminates the current Pipeline.

Observability

log

A log step emits a message through an event emitter. Can be a plain string or a template with state placeholders.

Composition

subgraph

A subgraph executes another Pipeline as a step, with flexible input/output mapping.

Last updated