A graph builder that constructs a sequential graph from a list of nodes.
Automatically links nodes with one-directional edges from the first to the last
and sets the start and end nodes accordingly.
Constructors
Methods
Hierarchy
Constructors
constructor
new SequentialGraphBuilder ( opts : SequentialGraphBuilderProps ): SequentialGraphBuilder
Creates a new instance of SequentialGraphBuilder and builds the sequential graph.
Parameters
opts
SequentialGraphBuilderProps
required
The configuration options for the sequential graph builder.
Returns
SequentialGraphBuilder
Overrides
GraphBuilder .constructor
Methods
addSequentialNode
addSequentialNode ( node : AbstractNode ): SequentialGraphBuilder
Adds a node to the graph, links it from the previous end node (if any),
and sets the passed node as the new end node.
Parameters
The node to add to the graph.
Returns
SequentialGraphBuilder
The current builder instance.
addComponent
addComponent ( component : Component | AbstractComponent ): this
Adds a component to the graph configuration.
Parameters
component
Component | AbstractComponent
required
Component to add to the graph
Returns
this
The graph instance for method chaining
Inherited from
GraphBuilder .addComponent
addEdge
addEdge (
fromNode : string | Node | AbstractNode ,
toNode : string | Node | AbstractNode ,
options ?: {
condition? : CustomEdgeConditionReference | EdgeConditionCallback ;
conditionExpression ?: string ;
loop ?: boolean ;
optional ?: boolean ;
},
): this
Adds an edge connecting two nodes in the graph.
Parameters
fromNode
string | Node | AbstractNode
required
Source node
toNode
string | Node | AbstractNode
required
Destination node
Optional edge configuration condition
CustomEdgeConditionReference | EdgeConditionCallback
Reference to a registered custom condition or a callback to register one
CEL expression for conditional execution
Whether the edge creates a loop
Whether the edge is optional
Returns
this
The builder instance for method chaining
Inherited from
GraphBuilder .addEdge
addIntentSubgraph
addIntentSubgraph (
id : string ,
parameters : IntentSubgraphProps ,
): SequentialGraphBuilder
Adds an intent subgraph to the graph.
Parameters
Unique identifier for the subgraph
parameters
IntentSubgraphProps
required
Intent subgraph parameters Array of intent configurations
Template for LLM prompting
LLM component instance or configuration
Embedder component instance or configuration
Similarity threshold for matching
Text generation configuration
Maximum intents to send to LLM
Maximum phrases per intent
embeddingSimilarityThreshold
Embedding similarity threshold
Number of top intents to return
Returns
SequentialGraphBuilder
The graph instance for method chaining
Inherited from
GraphBuilder .addIntentSubgraph
addNode
addNode ( node : Node | AbstractNode ): this
Adds a node to the graph.
If an AbstractNode is provided without corresponding component, internal components are automatically added.
Parameters
node
Node | AbstractNode
required
Node to add to the graph
Returns
this
The graph instance for method chaining
Inherited from
GraphBuilder .addNode
addSubgraph
addSubgraph ( subgraph : SubgraphBuilder ): this
Adds a subgraph to the graph configuration.
Parameters
Subgraph builder instance to be added
Returns
this
The graph instance for method chaining
Inherited from
GraphBuilder .addSubgraph
build
Creates a graph executor instance for running the graph.
Returns
Graph
GraphExecutor instance configured with this graph
Inherited from
GraphBuilder .build
setEndNode
setEndNode ( node : string | Node | AbstractNode ): this
Sets the end node of the graph.
Parameters
node
string | Node | AbstractNode
required
End node
Returns
this
The graph instance for method chaining
Inherited from
GraphBuilder .setEndNode
setEndNodes
setEndNodes ( nodes : ( string | Node | AbstractNode )[]): this
Sets multiple end nodes for the graph.
Parameters
nodes
(string | Node | AbstractNode)[]
required
Array of end nodes
Returns
this
The graph instance for method chaining
Inherited from
GraphBuilder .setEndNodes
setStartNode
setStartNode ( node : string | Node | AbstractNode ): this
Sets the start node of the graph.
Parameters
node
string | Node | AbstractNode
required
Start node
Returns
this
The graph instance for method chaining
Inherited from
GraphBuilder .setStartNode
setStartNodes
setStartNodes ( nodes : ( string | Node | AbstractNode )[]): this
Sets multiple start nodes for the graph.
Parameters
nodes
(string | Node | AbstractNode)[]
required
Array of start nodes
Returns
this
The graph instance for method chaining
Inherited from
GraphBuilder .setStartNodes