-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resuming a GroupChat #2627
Resuming a GroupChat #2627
Conversation
…improved robustness on resuming messages parameter
Okay, added further tests and added to the notebook with termination and resume examples. Please note that resume needs to start from the manager to maintain the conversation as a group chat, otherwise if you start from another agent it looks to be just an agent-to-agent chat. |
@ekzhu @marklysze first of all, thank you so much for this PR! I have a query. In common groupchat scenario of multiple agents, the chat may terminate due to any agent's termination message and the termination condition/keyword of each agent may be different. Think of an example like this: math_solver = autogen.AssistantAgent(
..,
system_message="Answer only if user query is related to mathematics, otherwise say 'TERMINATE'",
is_termination_msg="TERMINATE",
)
critic = autogen.AssistantAgent(
...,
system_message="Think step-by-step and analyze the solution. If everything looks good, say 'APPROVED'",
is_termination_msg="APPROVED",
) Now, when resuming the chat, the In this particular case, I think maintaining a map of termination strings for each agent would work; it can then be mapped to But, do you think allowing the |
Hey @aswny, thanks for your thoughts and identifying the use-case. I see a couple of options:
I think the function idea provides the most flexibility, though the list of termination strings may also work for the majority of use-cases. Creating a new PR would be a good idea to move this along. |
* Initial resume * Cleaned up resume function * Further updating resuming group chat * Added async resume_chat and documentation * Added test cases, refined group chat function parameters * compiled documentation * Added tests to main * Removed mdx file. * Revert "Merge remote-tracking branch 'origin/main' into groupchatresume" This reverts commit 8f70930, reversing changes made to 8bfcb2b. * Refactored resume to remove initiate_chat * fix git history * fix history * Added clean-up of objects, _groupchat references, and messages_to_string updated * Added termination-based resumption in notebook, added test cases and improved robustness on resuming messages parameter --------- Co-authored-by: Eric Zhu <[email protected]>
2024-05-11 - Update: The resume functionality no longer incorporates
initiate_chat
and, instead, sets up the group chat objects to be ready for resuming usinginitiate_chat
afterwards.Why are these changes needed?
It's not possible to currently resume a group chat. This PR includes the ability to resume a group chat using a list of messages.
The group chat can be resumed as follows:
resume_chat
on the manager object, passing in the set of messages as well as any other parameters (that will then be passed through to ConversableAgent'sinitiate_chat
.The resume function does the following:
initiate_chat
on the last speaker to kick-off the resuming conversation.max_round
property is still utilised and does not include the original messages (e.g. ifmax_round
is 3 it will resume for 3 more rounds)The changes include:
Why does it use ConversableAgent's
initiate_chat
instead of the manager'srun_chat
?initiate_chat
will call the manager'srun_chat
as part of the manager's attached reply functions. Additionally,initiate_chat
provides the ability to setsilent
and supports summarisation.Serialising state
The only state required is the messages. This in straightforward to serialise and persist. New functions on GroupChatManager,
messages_to_string
andmessages_from_string
will assist with the serialisation and deserialisation, respectively.Validating the group chat
As we only use messages as input, it can provide basic validation that the
name
in each message aligns with the group chat's agents. This doesn't guarantee that the original group chat setup is the same as the one used for resuming.Similarly, the developer will need to create the group chat objects themselves, rather than having it restored from state.
Future work can be done to increase the state to include all the group chat objects.
Testing in notebooks
I've run the resume functionality using the groupchat notebooks. I've saved these here.
Automated testing the group chat
I have not included testing the group chat resume in full in the test cases. I'd like to test this but I'm not sure how to test it effectively using LLMs/OpenAI - any help here is appreciated.
Notes:
Related issue number
This PR has been created from the need identified in issue #2359 and is associated with the discussion #2301.
Aligned with Roadmap #2358.
Checks