Skip to content

Commit e90b9aa

Browse files
milkmeatekzhu
andauthored
fix "keep_first_message" to make sure messages are in correct order, (#4653)
described in #3178 (comment) Co-authored-by: Eric Zhu <[email protected]>
1 parent 837b2e0 commit e90b9aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

autogen/agentchat/contrib/capabilities/transforms.py

Lines changed: 1 addition & 1 deletion
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)