Skip to content

Commit

Permalink
modify according to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
qbc2016 committed Jan 16, 2024
1 parent 2b885c6 commit c588138
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions notebook/conversation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,15 @@
"collapsed": false
},
"source": [
"In this notebook, we will show a demo of how to program a multi-agent conversation in AgentScope.Complete code is in `examples/conversation/conversation.py`, which sets up a user agent and an assistant agent to have a conversation. When user input \"exit\", the conversation ends. You can modify the sys_prompt to change the role of assistant agent."
"In this notebook, we will show a demo of how to program a multi-agent conversation in AgentScope. The complete codes can be found in `examples/conversation/conversation.py`, which sets up a user agent and an assistant agent to have a conversation. When user input \"exit\", the conversation ends. You can modify the `sys_prompt` to change the role of assistant agent."
]
},
{
"cell_type": "markdown",
"id": "28c4c4dc-7107-45e5-9ef4-f6506a0d55e2",
"id": "5f8b1a15-cf1a-46ff-8a62-88d7476c8608",
"metadata": {},
"source": [
"To install AgentScope, you need to have Python 3.9 or higher installed."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6dbd5990-ed46-4727-84b1-d4131c5a6245",
"metadata": {},
"outputs": [],
"source": [
"!pip install AgentScope"
"To install AgentScope, please follow the steps in [README.md](https://github.com/alibaba/AgentScope/blob/main/README.md#installation)."
]
},
{
Expand All @@ -53,7 +43,7 @@
"source": [
"import agentscope\n",
"from agentscope.agents import DialogAgent\n",
"from agentscope.agents.user_agent import UserAgent\n",
"from agentscope.agents import UserAgent\n",
"from agentscope.pipelines.functional import sequentialpipeline\n",
"\n",
"agentscope.init(\n",
Expand Down Expand Up @@ -87,7 +77,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"id": "848270c3-b73b-482d-a426-49e0ac67dc39",
"metadata": {},
"outputs": [],
Expand All @@ -110,6 +100,27 @@
"Start the conversation between user and assistant. Input \"exit\" to quit."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e46f7a9d-355b-46cd-86b5-201c91eabffb",
"metadata": {},
"outputs": [],
"source": [
"x = None\n",
"while x is None or x.content != \"exit\":\n",
" x = dialog_agent(x)\n",
" x = user_agent(x)"
]
},
{
"cell_type": "markdown",
"id": "adc601a8-144f-4e42-bc86-f0e14adb39b5",
"metadata": {},
"source": [
"To code it easier, you can use pipeline in [`agentscope.pipelines`](https://github.com/alibaba/AgentScope/blob/main/src/agentscope/pipelines/pipeline.py) and [`agentscope.pipelines.functional`](https://github.com/alibaba/AgentScope/blob/main/src/agentscope/pipelines/functional.py)."
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit c588138

Please sign in to comment.