When a node has multiple input parameters, Runchat lines up the data from each one and runs the node once per matched set. This page covers the default heuristics and the depth control you can use to override them.
Default matching heuristics
When a node has a single parameter with one item, no matching is needed. The node processes the input and returns a single output.
For example: plug a text input into a prompt and run the node, you get one response.
When a parameter receives multiple items, the node processes each one and returns a list of outputs in the same shape.
For example: plug two text inputs into the prompt of an Agent node and you get two responses back.
In some cases you might instead want those items joined into a single input. If you write one piece of text describing a style and another describing content, and connect both to a Create node’s prompt, you might want to combine them into one image. Concatenate the text first, or use all depth to wrap them as a single value.
When a node has multiple input parameters and each receives the same number of items, Runchat zips them together: it runs the node with the first item from each parameter, then the second, then the third, and so on.
For example: connect prompt and context lists of equal length to an Agent node and you get one response per prompt-context pair.
When parameters have different counts, Runchat zips matching items and reuses the last item from each shorter parameter to fill the gap.
For example: write one set of instructions and connect 10 different prompts to an Agent node. Each prompt is paired with the same single instruction.
Some data types are themselves made up of multiple items. The Context type
contains multiple messages, and a Message can contain multiple parts.
Depth: overriding the default
The depth setting on each parameter connection controls list behaviour. Hover an input handle to open the connection control.
Each (depth = 0)
Individual items are passed to the parameter independently of one another. This is the default behaviour.
All (depth > 0)
Individual items are all passed to the parameter in a single list. Each level of depth adds one layer of nesting. This allows for one-to-many matching, for instance to match a single prompt with multiple reference images.
Flatten (depth less than 0)
Nested arrays are flattened before being passed to the parameter. Each level of negative depth removes one layer of nesting. This is useful when you want to unwrap grouped results into a flat list.
Next steps
- Data Structure: items, lists, and objects
- Data Types: how Runchat casts values between types
- Loops: for recursive workflows where a node feeds itself