mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-10 03:37:51 +02:00
[Docs] update node name (#498)
This commit is contained in:
@@ -1113,16 +1113,14 @@
|
||||
"\n",
|
||||
"# Define nodes: these do the work\n",
|
||||
"builder.add_node(\"assistant\", Assistant(part_1_assistant_runnable))\n",
|
||||
"builder.add_node(\"action\", create_tool_node_with_fallback(part_1_tools))\n",
|
||||
"builder.add_node(\"tools\", create_tool_node_with_fallback(part_1_tools))\n",
|
||||
"# Define edges: these determine how the control flow moves\n",
|
||||
"builder.set_entry_point(\"assistant\")\n",
|
||||
"builder.add_conditional_edges(\n",
|
||||
" \"assistant\",\n",
|
||||
" tools_condition,\n",
|
||||
" # \"action\" calls one of our tools. END causes the graph to terminate (and respond to the user)\n",
|
||||
" {\"action\": \"action\", END: END},\n",
|
||||
")\n",
|
||||
"builder.add_edge(\"action\", \"assistant\")\n",
|
||||
"builder.add_edge(\"tools\", \"assistant\")\n",
|
||||
"\n",
|
||||
"# The checkpointer lets the graph persist its state\n",
|
||||
"# this is a complete memory for the entire graph.\n",
|
||||
@@ -1941,20 +1939,20 @@
|
||||
"builder.add_node(\"fetch_user_info\", user_info)\n",
|
||||
"builder.set_entry_point(\"fetch_user_info\")\n",
|
||||
"builder.add_node(\"assistant\", Assistant(part_2_assistant_runnable))\n",
|
||||
"builder.add_node(\"action\", create_tool_node_with_fallback(part_2_tools))\n",
|
||||
"builder.add_node(\"tools\", create_tool_node_with_fallback(part_2_tools))\n",
|
||||
"builder.add_edge(\"fetch_user_info\", \"assistant\")\n",
|
||||
"builder.add_conditional_edges(\n",
|
||||
" \"assistant\", tools_condition, {\"action\": \"action\", END: END}\n",
|
||||
" \"assistant\", tools_condition,\n",
|
||||
")\n",
|
||||
"builder.add_edge(\"action\", \"assistant\")\n",
|
||||
"builder.add_edge(\"tools\", \"assistant\")\n",
|
||||
"\n",
|
||||
"memory = SqliteSaver.from_conn_string(\":memory:\")\n",
|
||||
"part_2_graph = builder.compile(\n",
|
||||
" checkpointer=memory,\n",
|
||||
" # NEW: The graph will always halt before executing the \"action\" node.\n",
|
||||
" # NEW: The graph will always halt before executing the \"tools\" node.\n",
|
||||
" # The user can approve or reject (or even alter the request) before\n",
|
||||
" # the assistant continues\n",
|
||||
" interrupt_before=[\"action\"],\n",
|
||||
" interrupt_before=[\"tools\"],\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
@@ -2560,7 +2558,7 @@
|
||||
"memory = SqliteSaver.from_conn_string(\":memory:\")\n",
|
||||
"part_3_graph = builder.compile(\n",
|
||||
" checkpointer=memory,\n",
|
||||
" # NEW: The graph will always halt before executing the \"action\" node.\n",
|
||||
" # NEW: The graph will always halt before executing the \"tools\" node.\n",
|
||||
" # The user can approve or reject (or even alter the request) before\n",
|
||||
" # the assistant continues\n",
|
||||
" interrupt_before=[\"sensitive_tools\"],\n",
|
||||
@@ -3395,11 +3393,7 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 32,
|
||||
"id": "fb812818-99c9-4bf3-b1e5-a394c7b9058d",
|
||||
"metadata": {
|
||||
"vscode": {
|
||||
"languageId": "plaintext"
|
||||
}
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from typing import Callable\n",
|
||||
|
||||
Reference in New Issue
Block a user