Nodes
The VectorShift SDK provides different classes for each Node. Link nodes together by passing forward outputs. Data types are checked for compatibility upon node initialization.
Nodes and NodeOutputs
Pipelines are composed of nodes, which represent units of computation. They correspond with the individual nodes created in the drag-and-drop, no-code, editor. For every node in a no-code editor, you can create a corresponding, equivalent, node object with the Python SDK with just a few lines of code.
Nodes are connected via NodeOutput
objects, which correspond to (directed) edges in the computation graph. Each NodeOutput
has a type associated with it (see below). The general pattern for constructing pipelines is thus to feed the NodeOutput
s from earlier nodes into later ones. To gain intuition for this pattern, we suggest looking at the walkthrough.
Each node object has the following general structure:
Its constructor takes arguments representing class-specific parameters and zero or more
NodeOutput
s, which correspond to inputs to the node from previous nodes (edges in the pipeline computation graph).It exposes outputs via an
outputs()
method, which returns a dictionary keyed by strings of the output names and containingNodeOutput
values. If the node returns only one output, theNodeOutput
can directly be accessed via anoutput()
method.Upon initialization, the node checks that the
NodeOutput
s that were passed in as inputs are compatible with its expected input types. Whenoutputs()
oroutput()
is called, the resultingNodeOutput
is given a type determined by the node.
Some nodes refer to objects that already must exist on the VectorShift platform (e.g. files, integrations). For these nodes, initialization methods will make an API call behind-the-scenes to retrieve the object, so constructors require an API key, along with the ID/name of the object. If you have already added API keys as environment variables, you do not need to supply them as constructor arguments.
The Node Classes page contains specific details on all the nodes we support, including the expected constructor arguments, input types, and output types.
NodeOutput Typing
To ensure that nodes operate with each other in well-formed ways, NodeOutput
s each have specific data types. Information about data types can be found in the Platform section here. Similar to the no-code editor, we return errors if the expected input data type of a node used as an input is not compatible with the expected data type of the input. If the input data type is a subtype of the given data type, a warning is printed when the pipeline is constructed (as "casting" types when running the pipeline may not succeed).
In Node Classes, we indicate for each node its expected input and output datatypes. These can help you catch possible errors with your pipelines before they are uploaded to the VectorShift platform.
Last updated