Input Mapping

Input mapping in gllm_pipeline allows you to control how data flows from the pipeline state and runtime configuration into your components.

Input sources

When you create some steps, you need to specify how data flows from the pipeline into your component.

There are three main sources of data:

  1. Pipeline State: Data that flows through the pipeline from step to step. This is mutable.

  2. Runtime Configuration: Settings that can only be changed at runtime. This is immutable.

  3. Fixed Values: Constants that never change. This is also immutable.

Using input_map

The input_map is an argument that can be passed into some steps to define where they get their inputs from. It is the dictionary, where:

  • Keys are component argument names.

  • Values can be:

    • Strings: State/config keys (tries state first, then config).

    • Val objects: Fixed/literal value.

Let's see how input_map works when you actually invoke a pipeline. This example shows the complete flow from pipeline creation to execution:

For better ergonomics, input_map also accepts a list format:

The Three Input Mapping Parameters

1. input_state_map

Maps component input arguments to pipeline state keys. The component receives values from the pipeline state.

2. runtime_config_map

Maps component input arguments to runtime configuration keys. The component receives values from the runtime configuration.

3. fixed_args

Provides fixed values directly to component arguments. These values don't come from state or config.

Combining the Three Parameters

You could combine all three approaches, with fixed_args taking precedence over runtime_config_map, which takes precedence over input_state_map.

Last updated