mirror of
https://github.com/microsoft/FLAML.git
synced 2026-02-09 02:09:16 +08:00
Improve auto reply registration (#1170)
* Improve auto reply registration * object key * fix test error * bug fix in math user proxy agent * allow send/receive without reply * reset -> stop
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
@@ -8,6 +9,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
@@ -34,6 +36,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
@@ -71,6 +74,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
@@ -106,6 +110,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
@@ -114,44 +119,31 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import sys\n",
|
||||
"\n",
|
||||
"llm_config = {\"config_list\": config_list_gpt4}\n",
|
||||
"group_chat_manager = autogen.GroupChatManager(max_round=4, llm_config=llm_config)\n",
|
||||
"human = autogen.GroupChatParticipant(\n",
|
||||
"human = autogen.UserProxyAgent(\n",
|
||||
" name=\"Human\",\n",
|
||||
" system_message=\"A human admin.\",\n",
|
||||
" human_input_mode=\"ALWAYS\",\n",
|
||||
" llm_config=False,\n",
|
||||
" group_chat_manager=group_chat_manager,\n",
|
||||
")\n",
|
||||
"alice = autogen.GroupChatParticipant(\n",
|
||||
"alice = autogen.AssistantAgent(\n",
|
||||
" name=\"Alice\",\n",
|
||||
" system_message=autogen.AssistantAgent.DEFAULT_SYSTEM_MESSAGE,\n",
|
||||
" max_consecutive_auto_reply=sys.maxsize,\n",
|
||||
" human_input_mode=\"NEVER\",\n",
|
||||
" llm_config=llm_config,\n",
|
||||
" code_execution_config=False,\n",
|
||||
" group_chat_manager=group_chat_manager,\n",
|
||||
")\n",
|
||||
"bob = autogen.GroupChatParticipant(\n",
|
||||
"bob = autogen.AssistantAgent(\n",
|
||||
" name=\"Bob\",\n",
|
||||
" system_message=\"Code reviewer. Prevent code execution if unsafe or not well documented. Suggest changes. Otherwise, approve and return the final code to execute.\",\n",
|
||||
" max_consecutive_auto_reply=sys.maxsize,\n",
|
||||
" human_input_mode=\"NEVER\",\n",
|
||||
" llm_config=llm_config,\n",
|
||||
" code_execution_config=False,\n",
|
||||
" group_chat_manager=group_chat_manager,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"group_chat_manager.agents = [human, alice, bob]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"attachments": {},
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
@@ -160,7 +152,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -181,13 +173,7 @@
|
||||
"\n",
|
||||
"find a latest paper about generative agents\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[33mAlice\u001b[0m (to chat_manager):\n",
|
||||
"\n",
|
||||
"As an AI, I am unable to browse or search the web, download or read a file directly. But I can provide you with a Python script to scrape Google Scholar for the latest papers on generative agents.\n",
|
||||
@@ -256,10 +242,6 @@
|
||||
"Alternatively, databases like PubMed or arXiv.org provide free access to a large number of scientific papers - you might want to check them out for latest research papers on your topic of interest.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[31m\n",
|
||||
">>>>>>>> NO HUMAN INPUT RECEIVED.\u001b[0m\n",
|
||||
"\u001b[31m\n",
|
||||
">>>>>>>> USING AUTO REPLY...\u001b[0m\n",
|
||||
"\u001b[33mchat_manager\u001b[0m (to Bob):\n",
|
||||
"\n",
|
||||
"As an AI, I am unable to browse or search the web, download or read a file directly. But I can provide you with a Python script to scrape Google Scholar for the latest papers on generative agents.\n",
|
||||
@@ -388,10 +370,6 @@
|
||||
"Always use this script carefully because web-scraping isn't always reliable or legal on all web pages. Always ensure you have express permission or that the website's terms and conditions don't forbid this kind of usage.\n",
|
||||
"\n",
|
||||
"--------------------------------------------------------------------------------\n",
|
||||
"\u001b[31m\n",
|
||||
">>>>>>>> NO HUMAN INPUT RECEIVED.\u001b[0m\n",
|
||||
"\u001b[31m\n",
|
||||
">>>>>>>> USING AUTO REPLY...\u001b[0m\n",
|
||||
"\u001b[33mchat_manager\u001b[0m (to Alice):\n",
|
||||
"\n",
|
||||
"Your code as it stands can throw an exception and result in an error if the HTTP request fails or if no search results are found. Also, the use of 'beautifulsoup4' and 'requests' should be well-documented.\n",
|
||||
@@ -476,7 +454,7 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"human.send(\"find a latest paper about generative agents\", group_chat_manager)"
|
||||
"human.initiate_chat(group_chat_manager, message=\"find a latest paper about generative agents\")"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user