User Input Node
Overview
The User Input Node is designed to prompt the user for input during the execution of the graph. The user's response becomes the output of this node. This node is particularly useful in interactive scenarios where user input is required to proceed with the graph execution.
The User Input Node can either use a static prompt defined in the node settings or dynamic prompts provided via the node's input.
- Inputs
- Outputs
- Editor Settings
Inputs
Title | Data Type | Description | Default Value | Notes |
---|---|---|---|---|
Questions | string[] | An array of questions to prompt the user. | N/A | This input is only available when the "Use Input" toggle is enabled in the node settings. |
Outputs
Title | Data Type | Description | Notes |
---|---|---|---|
Answers Only | string[] | An array containing the user's answers to the prompted questions. | |
Q & A | string[] | An array containing the questions and answers formatted as "Question\nAnswer". |
Editor Settings
Setting | Description | Default Value | Use Input Toggle | Input Data Type |
---|---|---|---|---|
Prompt | The question to prompt the user. | (required) | Yes | string |
Example 1: Using a static prompt
- Create a User Input Node.
- In the node settings, set the "Prompt" to "What is your name?".
- Run the graph. The graph execution will pause and prompt you for input.
- Enter your name and press "Submit". The graph execution will resume and the output of the User Input Node will be the name you entered.
Example 2: Using dynamic prompts
- Create a User Input Node.
- In the node settings, enable the "Use Input" toggle.
- Create an Array Node and connect 2 Text Nodes to it.
- Add the text "What is your name?" to the first Text Node and "What is your favorite color?" to the second Text Node.
- Connect the Array Node to the "Questions" input of the User Input Node.
- Run the graph. The graph execution will pause and prompt you for input.
- Enter your answers and press "Submit". The graph execution will resume and the output of the User Input Node will be an array containing your answers.
Error Handling
The User Input Node does not have any error handling behavior. If the node is executed, it will always pause the graph execution and prompt the user for input.
FAQ
Q: Can I use the User Input Node to prompt the user for multiple inputs at once?
A: Yes, you can do this by connecting an Array Node to the "Questions" input of the User Input Node. Each item in the array will be a separate question that the user is prompted for.
Q: What happens if the user does not provide any input?
A: If the user does not provide any input and presses "Submit", the output of the User Input Node will be an empty string.
Q: Can I use the User Input Node to prompt the user for a password or other sensitive information?
A: No, the User Input Node does not currently support masking the user's input. All input provided by the user will be visible in the graph execution log.