一、下載LangChain chat ui
下載地址:點(diǎn)此下載 ,也可以使用官網(wǎng)線上版本 地址:https://agentchat.vercel.app/
二、安裝LangGraph cli
pip install -U langgraph
pip install -U "langgraph-cli[inmem]"
三、項(xiàng)目?jī)?nèi)創(chuàng)建langgraph.json
{
"dependencies": ["."],
"graphs": {
"agent": "./supervisor_agent.py:supervisor_agent" // agent的python文件:agent的名稱
},
"env": ".env"
}
四、執(zhí)行啟動(dòng)命令
langgraph dev --host 0.0.0.0 # 看到啟動(dòng)界面如下
INFO:langgraph_api.cli:
Welcome to
╦ ┌─┐┌┐┌┌─┐╔═╗┬─┐┌─┐┌─┐┬ ┬
║ ├─┤││││ ┬║ ╦├┬┘├─┤├─┘├─┤
╩═╝┴ ┴┘└┘└─┘╚═╝┴└─┴ ┴┴ ┴ ┴
- ?? API: http://127.0.0.1:2024
- ?? Studio UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024
- ?? API Docs: http://127.0.0.1:2024/docs
This in-memory server is designed for development and testing.
For production use, please use LangSmith Deployment.
五、安裝langchain chat ui依賴
此步驟針對(duì)本地運(yùn)行的chat ui,如果是線上版本直接跳過(guò)
進(jìn)入langchain chat ui的解壓目錄
執(zhí)行install命令
pnpm install
運(yùn)行啟動(dòng)命令
PS E:\workspace\AGI\項(xiàng)目\agent-chat-ui> pnpm dev # 看到一下結(jié)果表明啟動(dòng)成功過(guò)
> agent-chat-ui@0.0.0 dev E:\workspace\AGI\項(xiàng)目\agent-chat-ui
> next dev
▲ Next.js 15.5.14
- Local: http://localhost:3000
- Network: http://192.168.0.129:3000
- Experiments (use with caution):
· serverActions
? Starting...
? Ready in 2.6s
六、配置參數(shù)
打開(kāi)langchain-chat-ui地址,配置參數(shù)
Deployment UIL:本地langgraph dev命令獲取到的地址,一般為2024端口
Graph ID:langgraph.json配置文件下配置的agent名稱
點(diǎn)擊Continue即可使用