RedSenior

导航

智能体记忆


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

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 2024-12-15 20:46  RedLouie  阅读(0)  评论(0编辑  收藏  举报