From 6a55ee35c3f8447c4f6640eee02e2a9b51b7520b Mon Sep 17 00:00:00 2001 From: ideoutrea Date: Wed, 20 Mar 2024 20:07:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85Notebook=E6=A0=B7=E4=BE=8B?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cookbooks/agent_builder.ipynb | 46 ++++++++++++++++------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/cookbooks/agent_builder.ipynb b/cookbooks/agent_builder.ipynb index 377e43f7f..80cf900fd 100644 --- a/cookbooks/agent_builder.ipynb +++ b/cookbooks/agent_builder.ipynb @@ -43,12 +43,17 @@ "source": [ "import appbuilder\n", "import os\n", + "# 注意以下示例正确运行依赖的条件包括:\n", + "# 1. 在百度智能云千帆AppBuilder官网使用AgentBuilder创建应用且应用已发布\n", + "# 2. 密钥正确有效\n", + "# 3. 密钥需要与发布应用正确对应,即需要使用发布应用时的账户下的密钥\n", "\n", - "# 配置密钥\n", - "os.environ[\"APPBUILDER_TOKEN\"] =\"...\"\n", + "# 配置密钥与应用ID\n", + "os.environ[\"APPBUILDER_TOKEN\"] =\"secret_key\"\n", + "app_id = \"35f4fed3-d530-4dad-bc8e-f2150a4450be\"\n", "\n", - "# 使用获取到的应用ID,初始化Agent实例\n", - "agent_builder = appbuilder.AgentBuilder(\"35f4fed3-d530-4dad-bc8e-f2150a4450be\")\n", + "# 初始化Agent\n", + "agent_builder = appbuilder.AgentBuilder(app_id)\n", "\n", "# 创建会话ID\n", "conversation_id = agent_builder.create_conversation()\n", @@ -65,7 +70,8 @@ " print(\"快递查询助理生成的音频播放地址:\", ev.detail[\"audio\"])" ], "metadata": { - "collapsed": false + "collapsed": false, + "is_executing": true }, "id": "5b3a8a246cf0b467" }, @@ -97,11 +103,17 @@ "import os\n", "import appbuilder\n", "\n", - "# 配置密钥\n", + "# 注意以下示例正确运行依赖的条件包括:\n", + "# 1. 在百度智能云千帆AppBuilder官网使用AgentBuilder创建应用且应用已发布\n", + "# 2. 密钥正确有效\n", + "# 3. 密钥需要与发布的应用正确对应,即需要使用发布应用时的账户下的密钥\n", + "\n", + "# 配置密钥与应用ID\n", "os.environ[\"APPBUILDER_TOKEN\"] =\"...\"\n", + "app_id = \"7016e0d3-451b-4a47-a818-dc0a16d4b496\" \n", "\n", - "# 使用获取到的应用ID,初始化Agent实例\n", - "agent_builder = appbuilder.AgentBuilder(\"7016e0d3-451b-4a47-a818-dc0a16d4b496\")\n", + "# 初始化Agent实例\n", + "agent_builder = appbuilder.AgentBuilder(\"app_id\")\n", "\n", "# 创建会话ID\n", "conversation_id = agent_builder.create_conversation()\n", @@ -115,25 +127,9 @@ ], "metadata": { "collapsed": false, - "ExecuteTime": { - "end_time": "2024-03-20T06:23:38.529562Z", - "start_time": "2024-03-20T06:23:38.524388Z" - } + "is_executing": true }, "id": "4b825feeecbd7a2f" - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [], - "metadata": { - "collapsed": false, - "ExecuteTime": { - "start_time": "2024-03-20T06:23:38.526199Z" - } - }, - "id": "935f6b41870f190" } ], "metadata": {