I am encountering an error when using the "Resuming a GroupChat" feature. When I initialize the group chat for the first time, it works perfectly. However, after resuming the chat by passing the chat_history and attempting to call a function within the group chat, I receive the following error:
BadRequestError: Error code: 400 - {'error': {'message': "Invalid parameter: messages with role 'tool' must be a response to a preceding message with 'tool_calls'.", 'type': 'invalid_request_error', 'param': 'messages.[2].role', 'code': None}}
here is the code snippet i'm trying
groupchat = autogen.GroupChat(agents=LIST_OF_AGENTS, messages=[])
manager = autogen.GroupChatManager(
groupchat=groupchat,
llm_config=llm_config,
is_termination_msg=lambda x: "TERMINATE" in x.get("content", "")
)
# start the conversation for the first time
result=user_proxy.initiate_chat(
manager,
message = question,
clear_history=False,
)
# resume the group chat
last_agent, last_message = manager.resume(messages=result.chat_history, remove_termination_string="TERMINATE")
# getting error in this place
manager.initiate_chat(
recipient=user_proxy,
message="""can you get the previous task id and assign the task to john wick """,
clear_history=False,
)
the agent is using the fuction calls
Steps to reproduce
Initialize a group chat and use the "Resuming a GroupChat" feature.
Use a function call agent within the group chat.
Resume the group chat using chat_history messages and attempt to call the same function.
Describe the issue
I am encountering an error when using the "Resuming a GroupChat" feature. When I initialize the group chat for the first time, it works perfectly. However, after resuming the chat by passing the
chat_history
and attempting to call a function within the group chat, I receive the following error:here is the code snippet i'm trying
the agent is using the fuction calls
Steps to reproduce
chat_history
messages and attempt to call the same function.Screenshots and logs
No response
Additional Information
AutoGen Version: 0.2.32 Operating System: Wndows11 /ubuntu 20.04 Python Version: 3.11.2