At runtime, the Pipeline uses these variable names to transfer and share data between different steps. This mechanism is simple and intuitive, making it easy to build sequential data flows.
However, in multi-round calls or complex control structures, variable name conflicts or data overwriting may occur.
To address this, UR-2.0 provides a parameter renaming mechanism, allowing developers to flexibly rename variables in the Pipeline without modifying any source code.
How Does Data Flow?
Each Tool declares its own input and output variable names during registration, defining the entry and exit points of the data flow. For example:- The Tool receives two input variables:
q_lsandtop_k - The Tool returns one output variable:
ret_psg
retriever_search) but want to pass different input variables (such as q_ls for the first call and subq_ls for the second),you need a way to tell the Pipeline that these variables are “aliases” of the same parameter.
Parameter Renaming Mechanism
To resolve variable name conflicts and binding ambiguities, UR-2.0 provides a flexible parameter renaming mechanism.You can directly use the
input: and output: fields in the Pipeline YAML file to explicitly specify parameter-variable mappings—without modifying any Server code.
input: maps to the function’s parameter names, while output: maps to the output keys defined during Tool registration.
The simplest practice: keep input and output names consistent between function definitions and Tool registration to avoid confusion and unnecessary remapping.
Example 1: Input Variable Renaming
Suppose the Tool function is defined as follows:query_list, but we map it to the Pipeline variable sub_q_ls, achieving seamless data binding.
Example 2: Output Variable Renaming
Suppose the Tool is registered as follows:ret_psg,the result will be mapped to the variable
round1_result, which can be accessed by subsequent steps.
If a downstream module depends on this output:
qa_rag_boxed Tool will read ret_psg from the variable round1_result, successfully achieving data transfer between steps.