microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
34.8k stars 5.04k forks source link

[Feature Request]: Add ability to pass conversation history (messages) between group chats #3365

Open ebeckner-looptech opened 3 months ago

ebeckner-looptech commented 3 months ago

Is your feature request related to a problem? Please describe.

When using the AutoGen framework to manage group chats involving multiple agents, I encountered a limitation when attempting to resume a group chat. Specifically, I want to persist the conversation history from a previous group chat session and continue the conversation with the same or modified set of agents. However, when I use the GroupChatManager.resume method to resume a chat, the historical messages from the previous session are not injected into the new session. This results in the agents treating the resumed chat as a completely fresh conversation, ignoring any context from the previous chat session.

Currently, there is no built-in method to pass or persist historical messages directly between group chats, which limits the continuity of conversations across sessions.

I've noted that it is seemingly possible to inject messages within the messages= variable enumerated within groupchat. Nonetheless, passing a conversation history into this variable as a List[Dict] does not work. The agents simply ignore the previous conversation.

Describe the solution you'd like

Ideally, it would be nice is the manager.resume permitted conversations from other group chats to persist into new ones, irrespective of the population of either group.

An alternative fix to this issue might be to fix the issue with the messages= variable not being used/initialized when the groupchat begins.

I have not looked into source code, so I apologize for my ignorance on these matters.

Additional context

It would be lovely if this worked:

new_messages = [
    {"content": "Hi Bob, did you know that manta rays can change their skin color?", "role": "assistant"},
    {"content": "Hi Alice, no I did not know that?","name": "bob", "role": "user"},
]

groupchat = autogen.GroupChat(
    agents=[alice, bob],
    messages=new_messages,
    speaker_selection_method="round_robin",
    max_round=5,
)

manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config)

chat = alice.initiate_chat(
    manager,
    message="What was my first message to you?",
    clear_history=False,
)

Currently, the new_messages are ignored:

alice (to chat_manager):

What was my first message to you?


Next speaker: bob

bob (to chat_manager):

Your first message to me was: "What was my first message to you?"


akrentsel commented 1 month ago

running into the same issue. "messages" given to the group chat seem to just be completely ignored...

ekzhu commented 1 month ago

Did you set clear history to false when you use resume?

https://microsoft.github.io/autogen/0.2/docs/topics/groupchat/resuming_groupchat

azulika commented 9 hours ago

Same. It ignores the given initial messages even if clear history is set to False.