Skip to content

Commit

Permalink
Remove default trigger value for register_nested_chats (microsoft#1833)
Browse files Browse the repository at this point in the history
* remove default trigger value for register_nested_chats

* update notebook and test
  • Loading branch information
ekzhu authored Mar 1, 2024
1 parent 0a49f2a commit fcf14ee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autogen/agentchat/conversable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,15 @@ def _summary_from_nested_chats(
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,
) -> None:
"""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.
Expand Down
1 change: 1 addition & 0 deletions notebook/agentchat_nestedchat.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions test/agentchat/test_nested.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def writing_message(recipient, messages, sender, config):
]
assistant.register_nested_chats(
nested_chat_queue,
trigger=user,
)
user.initiate_chats([{"recipient": assistant, "message": tasks[0]}, {"recipient": assistant, "message": tasks[1]}])

Expand Down

0 comments on commit fcf14ee

Please sign in to comment.