RedSenior

导航

< 2024年12月 >
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 1 2 3 4
5 6 7 8 9 10 11

统计

智能体




点击查看代码
from langgraph.graph import START, StateGraph
from langgraph.prebuilt import tools_condition
from IPython.display import Image, display

# 初始化状态图
builder = StateGraph(MessagesState)

# 定义节点
builder.add_node("assistant", assistant)
builder.add_node("tools", ToolNode(tools))

# 定义边
builder.add_edge(START, "assistant")
builder.add_conditional_edges("assistant", tools_condition)
builder.add_edge("tools", "assistant")

# 编译图
react_graph = builder.compile()


posted on   RedLouie  阅读(1)  评论(0编辑  收藏  举报

点击右上角即可分享
微信分享提示