Need Guidance on Incorporating Conversation History in Group Chat API Requests
Hello I'm relatively new to Python, but I think I've figured out this framework. I'm currently working on a chat app that uses a group agent. My challenge is to incorporate previous conversation history for each user into new API requests. While I have managed to get it working in terminal mode with human_input_mode="ALWAYS",it work well, but each new POST request to my API seems to initiate a new conversation, disregarding history.
Questions:
- Is it possible to automatically include the history of past conversations in each new API request?
- Should I use List[Dict] ? If so, could someone clarify how to make use of it in this issue context?
I'll look forward to your reply. Thanks
@gagb @victordibia @afourney might have an answer.
I've used the following implementation before
- save the history somewhere (e.g., a db or file)
- upon a new request, first populate the agents with the relevant history:
- read history from db; use the
send()function to populate history
- read history from db; use the
initiate_chatbetween the agents with the new request
Lmk if this helps!
Thank you, @gagb I was also considering implementing it this way. I'm currently saving data in local storage of browser, but I had hoped we could use the cache and "seed" for this purpose. In any case, this solution works and is sufficient for now. Thanks. My implementation in group manager:
if history:
for msg_obj in history:
content = msg_obj.get("content", "")
if content:
userProxy.send(message=content, recipient=manager,request_reply=False, silent=True)
userProxy.initiate_chat(
manager,
silent=False,
clear_history=False,
message=user_message
)
could you provide a groupchat example that save history and the reload it on a new chat?
@camico63 Did you got any success on your implementation, I'm looking for the similar one.
could you provide a groupchat example that save history and the reload it on a new chat?
You can save the history, for instance in a file and once the chat resumes, you read the history from file and broadcast the meesages to all the agents. It will be like having a previous conversation continue. Please refer to the following link for more info: https://clintgoodman27.medium.com/a-practical-guide-for-using-autogen-in-software-applications-8799185d27ee
lots of relevant examples in new 0.4. closing. please reopen with a more specific question/details if you object.