CombineOutputs¶
合并多个上游步骤的输出。
CombineOutputs
是一个 Step
,它接受多个上游步骤的输出,并将它们组合起来以生成一个新字典,其中包含上游步骤输出的所有键/列。
输入 & 输出列¶
graph TD
subgraph Dataset
subgraph Columns
ICOL0[dynamic]
end
subgraph New columns
OCOL0[dynamic]
end
end
subgraph CombineOutputs
StepInput[Input Columns: dynamic]
StepOutput[Output Columns: dynamic]
end
ICOL0 --> StepInput
StepOutput --> OCOL0
StepInput --> StepOutput
输入¶
- 动态(基于上游
Step
):上游步骤输出的所有列。
输出¶
- 动态(基于上游
Step
):上游步骤输出的所有列。
示例¶
合并数据集的字典¶
from distilabel.steps import CombineOutputs
combine_outputs = CombineOutputs()
combine_outputs.load()
result = next(
combine_outputs.process(
[{"a": 1, "b": 2}, {"a": 3, "b": 4}],
[{"c": 5, "d": 6}, {"c": 7, "d": 8}],
)
)
# [
# {"a": 1, "b": 2, "c": 5, "d": 6},
# {"a": 3, "b": 4, "c": 7, "d": 8},
# ]