Skip to content

Commit

Permalink
补充Notebook样例运行条件
Browse files Browse the repository at this point in the history
  • Loading branch information
ide-rea committed Mar 20, 2024
1 parent 8bfee14 commit 6a55ee3
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions cookbooks/agent_builder.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -65,7 +70,8 @@
" print(\"快递查询助理生成的音频播放地址:\", ev.detail[\"audio\"])"
],
"metadata": {
"collapsed": false
"collapsed": false,
"is_executing": true
},
"id": "5b3a8a246cf0b467"
},
Expand Down Expand Up @@ -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",
Expand All @@ -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": {
Expand Down

0 comments on commit 6a55ee3

Please sign in to comment.