Skip to content

Commit

Permalink
chainlit chainlit_agent支持工作流Agent应用 (#664)
Browse files Browse the repository at this point in the history
* chainlit chainlit_agent支持工作流Agent应用

* update
  • Loading branch information
userpj authored Dec 13, 2024
1 parent b06664f commit 574d169
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
13 changes: 8 additions & 5 deletions cookbooks/components/agent_runtime.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
"source": [
"**1.3 对话框交互AppBuilderClient**\n",
"\n",
"基于 chainlit 的对话框交互AppBuilderClient,可实现对话交互。\n",
"基于 chainlit 的对话框交互AppBuilderClient,可实现对话交互。支持工作流Agent、自主规划Agent应用。\n",
"\n",
"执行下面的代码,会启动一个 chainlit 页面,页面地址:0.0.0.0:8091。可在页面上上传文档(可选)、执行对话。"
]
Expand All @@ -372,8 +372,8 @@
"os.environ[\"APPBUILDER_TOKEN\"] = \"...\"\n",
"# 使用之前,在官网个人空间获取应用ID,如下图\n",
"app_id= \"...\"\n",
"agent_builder = appbuilder.AppBuilderClient(app_id)\n",
"agent = appbuilder.AgentRuntime(component=agent_builder)\n",
"client = appbuilder.AppBuilderClient(app_id)\n",
"agent = appbuilder.AgentRuntime(client)\n",
"agent.chainlit_agent(port=8091)"
]
},
Expand All @@ -385,8 +385,11 @@
"在官网个人空间获取应用ID\n",
"![get app_id](../app_builder_resources/app_id.png)\n",
"\n",
"使用服务上传文件并对话示意图如下所示\n",
"![chainlit demo](./image/agent_runtime_with_chainlit_agent.png)"
"使用服务上传文件并对话示例图如下所示\n",
"![chainlit demo](./image/agent_runtime_with_chainlit_agent.png)\n",
"\n",
"使用工作流Agent应用对话示例如下图所示\n",
"![chainlit demo](./image/agent_runtime_with_chainlit_chatflow.png)"
]
},
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions docs/BasisModule/Deployment/agentruntime.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ agent.chainlit_demo(port=8091)
```

### 5、将 appbuilder client 服务化,提供 chainlit demo 页面`AgentRuntime.chainlit_agent(host='0.0.0.0', port=8091)`

目前支持工作流Agent、自主规划Agent应用。

#### 方法参数

Expand All @@ -172,9 +172,7 @@ import os

os.environ["APPBUILDER_TOKEN"] = '...'
app_id = '...' # 已发布AppBuilder应用ID,可在console端查看
builder = appbuilder.AppBuilderClient(app_id)
conversation_id = builder.create_conversation()
agent = appbuilder.AgentRuntime(component=builder)
message = appbuilder.Message({"query": "北京今天天气怎么样"})
print(agent.chat(message, stream=False))
client = appbuilder.AppBuilderClient(app_id)
agent = appbuilder.AgentRuntime(component=client)
agent.chainlit_agent(port=8091)
```

0 comments on commit 574d169

Please sign in to comment.