-
Notifications
You must be signed in to change notification settings - Fork 263
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
Swarm: User-defined AfterWork string for agent selection using LLM #369
Conversation
Signed-off-by: Mark Sze <[email protected]>
…armafterworkmgrmsg
Signed-off-by: Mark Sze <[email protected]>
Signed-off-by: Mark Sze <[email protected]>
Signed-off-by: Mark Sze <[email protected]>
Signed-off-by: Mark Sze <[email protected]>
Signed-off-by: Mark Sze <[email protected]>
Signed-off-by: Mark Sze <[email protected]>
Signed-off-by: Mark Sze <[email protected]>
Signed-off-by: Mark Sze <[email protected]>
Signed-off-by: Mark Sze <[email protected]>
Signed-off-by: Mark Sze <[email protected]>
Thanks for the initial review @sonichi, if you could have another look over now that would be appreciated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good to me overall. My only question is about the context_str class. I think this class might not be necessary at all, and also consider existing packages like dedent
.
…armafterworkmgrmsg
Thanks all, merging so we can merge swarm to conversable. |
* Moved functions and update_agent_state_before_reply parameters and associated functions Signed-off-by: Mark Sze <[email protected]> * Move SwarmAgent functions out or to ConversableAgent Signed-off-by: Mark Sze <[email protected]> * Move SwarmAgent init to function Signed-off-by: Mark Sze <[email protected]> * Updated agent's string representation Signed-off-by: Mark Sze <[email protected]> * Update swarm tests and add to ConversableAgent tests Signed-off-by: Mark Sze <[email protected]> * Agent string representation, documentation updates for SwarmAgent and register_hand_off Signed-off-by: Mark Sze <[email protected]> * Updated test for agent string representation Signed-off-by: Mark Sze <[email protected]> * Removed static method for Python 3.9 support Signed-off-by: Mark Sze <[email protected]> * Update autogen/agentchat/conversable_agent.py Co-authored-by: Chi Wang <[email protected]> * Summary from nested chat refactoring, comment fix Signed-off-by: Mark Sze <[email protected]> * UPDATE_SYSTEM_MESSAGE, AFTER_WORK, ON_CONDITION to UpdateSystemMessage / AfterWork / OnCondition Signed-off-by: Mark Sze <[email protected]> * Copyright updates Signed-off-by: Mark Sze <[email protected]> * add new class UpdateCondition, unit test passed. * Code formatting * Code formatting * add document * Added UpdateCondition to init Signed-off-by: Mark Sze <[email protected]> * Documentation layout Signed-off-by: Mark Sze <[email protected]> * SwarmAgent deprecation Signed-off-by: Mark Sze <[email protected]> * Updated init Signed-off-by: Mark Sze <[email protected]> * Updated comments and UpdateSystemMessage attribute Signed-off-by: Mark Sze <[email protected]> * Update autogen/agentchat/__init__.py Co-authored-by: Chi Wang <[email protected]> * Update test/agentchat/test_conversable_agent.py Co-authored-by: Chi Wang <[email protected]> * Update autogen/agentchat/__init__.py Co-authored-by: Chi Wang <[email protected]> * Remove files from main that have been removed Signed-off-by: Mark Sze <[email protected]> * Swarm: User-defined AfterWork string for agent selection using LLM (#369) * Add next_agent_selection_msg Signed-off-by: Mark Sze <[email protected]> * Updated next_agent_selection_msg types, group chat constants Signed-off-by: Mark Sze <[email protected]> * Prepare group chat for auto speaker selection Signed-off-by: Mark Sze <[email protected]> * Documentation Signed-off-by: Mark Sze <[email protected]> * Add swarm_manager_args Signed-off-by: Mark Sze <[email protected]> * Updated initiate_swarm_chat in documentation Signed-off-by: Mark Sze <[email protected]> * Restore groupchat prompt template Signed-off-by: Mark Sze <[email protected]> * constant name change, callable updated to be final string, documentation Signed-off-by: Mark Sze <[email protected]> * Introduce ContextStr, remove UpdateCondition, add documentation Signed-off-by: Mark Sze <[email protected]> * Update init Signed-off-by: Mark Sze <[email protected]> * Documentation Signed-off-by: Mark Sze <[email protected]> --------- Signed-off-by: Mark Sze <[email protected]> Co-authored-by: Yiran Wu <[email protected]> * Test updates Signed-off-by: Mark Sze <[email protected]> --------- Signed-off-by: Mark Sze <[email protected]> Co-authored-by: Chi Wang <[email protected]> Co-authored-by: [email protected] <[email protected]> Co-authored-by: Yiran Wu <[email protected]>
Why are these changes needed?
In line with #26, this provides the developer with an option to specify a string prompt for an LLM to use to select the next agent in an agent's AfterWork hand off.
It extends the AfterWorkOption.SWARM_MANAGER (which, by default, uses the default
auto
speaker selection options) with an additional AfterWork parameter,next_agent_selection_msg
, which becomes the selection prompt used by the LLM.next_agent_selection_msg
can be a string or a Callable that returns a string.The signature for the Callable is:
def my_selection_message(agent: ConversableAgent, messages: List[Dict[str, Any]]) -> str
The string provided, or returned from the
Callable
, will have the following string substitutions:{agentlist}
will be replaced by a comma-delimited list of agentsThe underlying groupchat's GroupChatManager will be used for the speaker selection and must, therefore, have an LLM Config. This can be set through the new
swarm_manager_args
parameter ona/initiate_swarm_chat
.Example:
Related issue number
#26
Checks