Map Node
In pipelines you may want to repeat the same action on multiple pieces of data. The map node can be used to run nodes across multiple inputs.
Last updated
In pipelines you may want to repeat the same action on multiple pieces of data. The map node can be used to run nodes across multiple inputs.
Last updated
The map node, has two input handles
inputs: The inputs should be pipeline output with multiple
function: Attach another node to act the the function that will be mapped over the inputs
The map node will execute the given function on each element of the inputs and combine the results in the output.
In this pipeline we show the key concepts for the map node
The split text node splits text on newlines and returns a list of strings
The map node is given the OpenAI LLM node as the function.
The LLM will be called with the system message on each of the elements from the split text node
The outputs from all the LLM calls are fed to the output node
Note how the OpenAI LLM has an empty prompt handle. This is the variable that will be filled in with each element of the Map node inputs. The system prompt will be the same for every execution
If we input the above text to the pipeline, the LLM will run on each line.
The output will be: