Clarifying the docstring for the add_edge function (#2782)

Revised docstring for StateGraph's add_edge method to clarify recurring
confusion #2775 #1462

---------

Co-authored-by: ashirgaokar <abhishek.shirgaokar@zee.com>
Co-authored-by: vbarda <vadym@langchain.dev>
This commit is contained in:
Abhishek Shirgaokar
2025-01-07 10:04:50 -05:00
committed by GitHub
co-authored by ashirgaokar vbarda
parent a36d2ac77d
commit e00284b386
+4 -2
View File
@@ -398,9 +398,11 @@ class StateGraph(Graph):
return self
def add_edge(self, start_key: Union[str, list[str]], end_key: str) -> Self:
"""Adds a directed edge from the start node to the end node.
"""Adds a directed edge from the start node (or list of start nodes) to the end node.
If the graph transitions to the start_key node, it will always transition to the end_key node next.
When a single start node is provided, the graph will wait for that node to complete
before executing the end node. When multiple start nodes are provided,
the graph will wait for ALL of the start nodes to complete before executing the end node.
Args:
start_key (Union[str, list[str]]): The key(s) of the start node(s) of the edge.