Skip to content

Commit 04dcc76

Browse files
committed
fix "keep_first_message" to make sure messages are in correct order,
described in #3178 (comment)
1 parent 9d581de commit 04dcc76

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

autogen/agentchat/contrib/capabilities/transforms.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def apply_transform(self, messages: List[Dict]) -> List[Dict]:
9696
if remaining_count == 1:
9797
# If there's only 1 slot left and it's a 'tools' message, ignore it.
9898
if messages[i].get("role") != "tool":
99-
truncated_messages.insert(1, messages[i])
99+
truncated_messages.insert(1 if self._keep_first_message else 0, messages[i])
100100

101101
remaining_count -= 1
102102
if remaining_count == 0:

0 commit comments

Comments
 (0)