Input and Output Transformers
Last updated
Last updated
Input transformers are used to map the outputs of the previous node to the inputs of the current node.
By selecting a node and clicking on the Input tab, we can add custom logic to the input transformer.
The input parameters of the OpenAI Node will be mapped with the input parameters of the Input Node.
In a workflow, if nodes are connected directly, an input transformer field will be empty and must to be written manually. However, if the parameters of the nodes are connected, the appropriate mapping will be automatically established - here's an example.
Output transformers serve a similar purpose as input transformers but are applied to the output of the nodes. They are particularly useful in cases where the output is shared among multiple nodes. This allows us to write the output transformer once, avoiding the need to create individual Input Transformers for each node that receives this output.
You can specify the logic for output transformers in the Output tab.
In this example, the ScaleSerp Node returns a dictionary of data containing both output and metadata. By using output transformers, we can extract only the results found under the result key.
Output transformers are also useful for ensuring proper parsing when passing an output to the Output Node that does not include an input transformer.
Both input and output transformers use the same syntax: