Skip to main content

Graph Input Node

Graph Input Node Screenshot

Overview

The Graph Input Node is used to define an input for a graph. This input can be passed in when the graph is called using the SDK, or defines one of the input ports when the graph is used as a subgraph.

The Graph Input Node is particularly useful for creating reusable subgraphs that can accept different inputs each time they are used. For example, you could create a subgraph that accepts a string input and outputs a string value with the input value appended to it. You could then use this subgraph in multiple places in your graph, passing in different values each time.

Inputs

TitleData TypeDescriptionDefault ValueNotes
Default ValueAnyThe default value for the input if no value is provided when the graph is called.(optional)The input will be coerced into the data type specified in the Editor Settings. This input is only available if the Use Default Value Input setting is enabled.

Example 1: Define an input for a graph

  1. Create a Graph Input Node.
  2. In the Editor Settings, set the ID to input1 and the Data Type to string. Set the Default Value to Hello World.
  3. Run the graph. The Graph Input Node will output the default value, Hello World.

Graph Input Node Example 1

Example 2: Use a Graph Input Node in a subgraph

  1. Create a new graph and add a Graph Input Node to it.
  2. In the Editor Settings, set the ID to input1 and the Data Type to string.
  3. Add a Text Node to the graph and connect the Graph Input Node to it.
  4. Save the graph and go back to the main graph.
  5. Add a Subgraph Node to the main graph and select the graph you just created.
  6. You will see that the Subgraph Node has an input port named input1. This is the input defined by the Graph Input Node in the subgraph.

Graph Input Node Example 2 Graph Input Node Example 2

Error Handling

The Graph Input Node will error if the input value cannot be coerced into the specified data type.

FAQ

Q: Can I use the Graph Input Node to define multiple inputs for a graph?

A: Yes, you can add multiple Graph Input Nodes to a graph to define multiple inputs. Each Graph Input Node will define a separate input for the graph.

Q: What happens if I don't provide a value for an input when calling a graph?

A: If you don't provide a value for an input when calling a graph, the Graph Input Node will use the default value specified in the Editor Settings. If the Use Default Value Input setting is enabled, the node will use the value provided to the Default Value input port.

Q: Can I use the Graph Input Node in the main graph?

A: Yes, you can use the Graph Input Node in the main graph to define inputs for the graph. These inputs can be provided when calling the graph using the SDK. See the RunGraphOptions documentation for more info.

See Also