File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 22Module for creating the base graphs
33 """
44import time
5+ import warnings
56from langchain_community .callbacks import get_openai_callback
67
78
@@ -26,12 +27,19 @@ class BaseGraph:
2627 entry_point (BaseNode): The node instance that represents the entry point of the graph.
2728 """
2829
29- def __init__ (self , nodes : list , edges : list ):
30+ def __init__ (self , nodes : list , edges : dict , entry_point : str ):
3031 """
3132 Initializes the graph with nodes, edges, and the entry point.
3233 """
33- self .nodes = nodes
34+
35+ self .nodes = {node .node_name : node for node in nodes }
3436 self .edges = self ._create_edges (edges )
37+ self .entry_point = entry_point .node_name
38+
39+ if nodes [0 ].node_name != entry_point .node_name :
40+ # raise a warning if the entry point is not the first node in the list
41+ warnings .warn (
42+ "Careful! The entry point node is different from the first node if the graph." )
3543
3644 def _create_edges (self , edges : list ) -> dict :
3745 """
You can’t perform that action at this time.
0 commit comments