-
Notifications
You must be signed in to change notification settings - Fork 121
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: Support for nested chat as a hand off #107
Conversation
Signed-off-by: Mark Sze <mark@sze.family>
Signed-off-by: Mark Sze <mark@sze.family>
Alternative proposal:
Then, modify |
For swarm, the callable method ( |
Good point. Can we then override the |
Okay, I'll have a look into that! |
Have added to documentation |
Signed-off-by: Mark Sze <mark@sze.family>
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.
Thanks @marklysze! It seems swarm test is not added to github workflow. We may want to add it later!
Why are these changes needed?
Extending the Swarm functionality by allowing a hand off to run a nested chat (a series of sequential chats, as per the existing nested chat functionality). The result of the nested chat will be a string (from the output of the last chat within the nested chat)
To add a nested chat hand off to an agent:
Where within the nested_chat dictionary:
chat_queue
reply_func_from_nested_chats
config
register_nested_chats
use_async
register_nested_chats
If
reply_func_from_nested_chats
is a Callable, it must have a signature of:def my_reply_func(chat_queue: List[Dict[str, Any]], recipient: Agent, messages: Union[str, Callable], sender: Agent, config: Any) -> Tuple[bool, Union[str, None]]:
Carryover
Additionally, you can push some context from the swarm's chat into the nested chat by way of incorporating a summary of the chat into the first nested chat's message. The configuration is similar to what is used when registering a nested chat for summarising the chat.
This is done via a
carryover_config
that you add to the first nested chat, e.g.:Where within the carryover_config dictionary:
The Callable must have a signature of:
def my_summary_method_func(agent: ConversableAgent, messages: List[Dict[str, Any]], summary_args: Dict[str, Any]) -> str:
The end result of the carryover is that the starting nested chat will have a message that's a concatenation of the message set in the first chat and the swarm's chat. For example the final first message in the example code above could be:
Summarise the conversation into a few key words\nContext:\nDucks are yellow\nDogs are blue\nCats are green.
If no
carryover_config
is set in the first nested chat, the nested chats will not carry through any messages from the swarm chat.Examples:
Related issue number
#26 New interface
Checks