-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Getting messages from the "agent" to the "groupchat manager": #3279
Comments
@sujan-sarker Could you please post the example codes to reproduce you problem? |
Hi Wenngong, from autogen import ConversableAgent, GroupChat, GroupChatManager LLM configurationllm_config = {"model": "gpt-4-turbo"} message_log = "" Callback function to print and store messagesdef print_and_store_messages(recipient, messages, sender, config):
Function to start the server and manage chatdef start_server():
if name == 'main': |
Hi @sujan-sarker , with your code, the
I've verified it in the |
Hi @thinkall |
Hi @sujan-sarker , any message chat_manager sends out is actually received from another agent. That to say, you can invoke the callbacks when "Sender: chat_manager receiver: coder ...". Say agent A send a message to chat_manager, you want to call the callback, but you can't, because in a group chat, you never see the receiver to be chat_manager. However, chat_manager will send this message to the next agent B, so you can call the callback function when B receives the message. The message and the callback function will be exactly the same. Would this work for you? |
Hi,
I highly appreciate your answer. I have two questions.
1. Is there any way to invoke the callback whenever an agent sends the
message to the chat manager in group chat ?
2. I actually need the sender information. For example, say agent A sends a
message and the chat manager forwards it to agent B. Using the code I can
invoke the callback when the chat manager sends the message of A to agent
B. So callback prints, sender: chat manager and receiver: B. How can I get
the original sender information (i.e., A)?
…On Tue, Aug 6, 2024, 10:36 PM Li Jiang ***@***.***> wrote:
Sender: User_proxy receiver: chat_manger ......
Hi @sujan-sarker <https://github.com/sujan-sarker> , any message
chat_manager sends out is actually received from another agent. That to
say, you can invoke the callbacks when "Sender: chat_manager receiver:
coder ...".
Say agent A send a message to chat_manager, you want to call the callback,
but you can't, because in a group chat, you never see the receiver to be
chat_manager. However, chat_manager will send this message to the next
agent B, so you can call the callback function when B receives the message.
The message and the callback function will be exactly the same.
Would this work for you?
—
Reply to this email directly, view it on GitHub
<#3279 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABX7ZJTOQZD3G4IA6U2325DZQGB4PAVCNFSM6AAAAABL33QCESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZSGUYDKNBVGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
All the history messages are stored in groupchat, below function could give you the real sender info. def print_and_store_messages(recipient, messages, sender, config):
# Print the message immediately
print(f"Sender: {sender.name} | Recipient: {recipient.name} | Message: {messages[-1].get('content')}")
print(f"Real Sender: {sender.groupchat.messages[-1].get("name", sender.name)}")
return False, None # Required to ensure the agent communication flow continues |
Hi @sujan-sarker , could you please help check if #3318 makes it easier for you to access the real sender? With the PR, you can access the real sender with: def print_and_store_messages(recipient, messages, sender, config):
# Print the message immediately
print(f"Sender: {sender.name} | Recipient: {recipient.name} | Message: {messages[-1].get('content')}")
print(f"Real Sender: {sender.last_speaker.name}")
return False, None # Required to ensure the agent communication flow continues |
Hi @thinkall , I am working on a similar project that needs to access the last message sender. The last_speaker attribute didn't exist. Is it due to the change hasn't been made yet? |
Hi @JinMizar , the PR is not merged yet. |
Describe the issue
Hi,
I am working on a project using the group chat manager to manage chats among multiple agents. We register a reply function to get sender, receiver, and message content whenever an agent sends a reply. However, it turned out that it only works for chat managers rather than for individual agents. Do you have any solution for that? I found the same problem in the following issue but couldn't find any solution.
#1050
Steps to reproduce
No response
Screenshots and logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: