You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In MessageHistoryLimiter, line 99 of the file.
It should take _keep_first_message into consider. otherwise when keep_first_message==False , the last message will be inserted in a wrong place.
# Loop through messages in reverse
for i in range(len(messages) - 1, 0, -1):
if remaining_count > 1:
truncated_messages.insert(1 if self._keep_first_message else 0, messages[i])
if remaining_count == 1:
# If there's only 1 slot left and it's a 'tools' message, ignore it.
if messages[i].get("role") != "tool":
- truncated_messages.insert(1, messages[i])
+ truncated_messages.insert(1 if self._keep_first_message else 0, messages[i])
for example, following code output is in wrong order
ekzhu
changed the title
[autogen/agentchat/contrib/capabilities/transforms.py](https://github.com/microsoft/autogen/blob/0.2/autogen/agentchat/contrib/capabilities/transforms.py)
MessageHistoryLimiter bug leading to incorrect order
Dec 10, 2024
In MessageHistoryLimiter, line 99 of the file.
It should take _keep_first_message into consider. otherwise when keep_first_message==False , the last message will be inserted in a wrong place.
for example, following code output is in wrong order
Originally posted by @milkmeat in #3178 (comment)
The text was updated successfully, but these errors were encountered: