Remove default trigger value for register_nested_chats (#1833)

* remove default trigger value for register_nested_chats

* update notebook and test
This commit is contained in:
Eric Zhu 2024-03-01 13:50:58 -08:00 committed by GitHub
parent 0a49f2a256
commit fcf14ee9e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 2 deletions

View File

@ -362,7 +362,7 @@ class ConversableAgent(LLMAgent):
def register_nested_chats(
self,
chat_queue: List[Dict[str, Any]],
trigger: Union[Type[Agent], str, Agent, Callable[[Agent], bool], List] = [Agent, None],
trigger: Union[Type[Agent], str, Agent, Callable[[Agent], bool], List],
reply_func_from_nested_chats: Union[str, Callable] = "summary_from_nested_chats",
position: int = 2,
**kwargs,
@ -370,7 +370,7 @@ class ConversableAgent(LLMAgent):
"""Register a nested chat reply function.
Args:
chat_queue (list): a list of chat objects to be initiated.
trigger (Agent class, str, Agent instance, callable, or list): Default to [Agent, None]. Ref to `register_reply` for details.
trigger (Agent class, str, Agent instance, callable, or list): refer to `register_reply` for details.
reply_func_from_nested_chats (Callable, str): the reply function for the nested chat.
The function takes a chat_queue for nested chat, recipient agent, a list of messages, a sender agent and a config as input and returns a reply message.
Default to "summary_from_nested_chats", which corresponds to a built-in reply function that get summary from the nested chat_queue.

View File

@ -800,6 +800,7 @@
"]\n",
"assistant_1.register_nested_chats(\n",
" nested_chat_queue,\n",
" trigger=user,\n",
")\n",
"# user.initiate_chat(assistant, message=tasks[0], max_turns=1)\n",
"\n",

View File

@ -112,6 +112,7 @@ def test_nested():
]
assistant.register_nested_chats(
nested_chat_queue,
trigger=user,
)
user.initiate_chats([{"recipient": assistant, "message": tasks[0]}, {"recipient": assistant, "message": tasks[1]}])