Race Inputs Node

Overview
The Race Inputs Node is used to handle multiple inputs and outputs the value of the first input to finish, force-cancelling the other inputs. This node is particularly useful when you have multiple operations such as LLM Chat Node calls that can potentially fulfill the same requirement, and you want to use the result of the operation that finishes first.
- Inputs
- Outputs
- Editor Settings
Inputs
| Title | Data Type | Description | Default Value | Notes |
|---|---|---|---|---|
| Input [i] | any | The ith input to be raced. The number of inputs is dynamic based on the number of connections | N/A | Dynamic number of inputs based on how many connections there are |
Outputs
| Title | Data Type | Description | Notes |
|---|---|---|---|
| Result | any | The value of the first input to finish. If no inputs finish, will not be ran | If no inputs finish, this output will not be ran, and the node will not error. |
Editor Settings
This node has no configurable editor settings.
Example 1: Race Two LLM Calls
- Create a new graph, and add two LLM Chat Nodes to the graph.
- Create a Prompt Node, and give it a prompt message that will be answered in a short time, such as "What is your favorite color?". Connect it to the
Promptinput of the first LLM Chat Node. - Create another Prompt Node, and give it a prompt message that will take a much longer time, such as "Describe to me in detail the story of Hamlet." Connect it to the
Promptinput of the second LLM Chat Node. - Connect both
Responseoutputs of the LLM Chat Nodes to a Race Inputs node. - Run the graph. Notice that the first LLM call finishes first, and the value of the Race Inputs node is the response from that node. The other LLM call gets canceled.

Error Handling
The Race Inputs Node will not error if none of the inputs finish. Instead, the Result output will not be ran.
FAQ
Q: What happens if none of the inputs finish?
A: If none of the inputs finish, the Race Inputs Node will not error. Instead, the Result output will not be ran.
Q: Can I use the Race Inputs Node with inputs of different data types?
A: Yes, the Race Inputs Node can handle inputs of any data type.
Q: What happens if one of the inputs errors?
A: If one of the inputs errors, the Race Inputs Node will not be affected. It will still output the value of the first input to finish, regardless of whether other inputs error.