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
The MessageTokenLimiter prints the number of tokens truncated, while the MessageHistoryLimiter doesn't print the number of messages removed. Also, the TransformMessages._print_stats method isn't working.
Steps to reproduce
Execute the following code:
from autogen.agentchat.contrib.capabilities import transform_messages, transforms
messages = [
{"role": "user", "content": "hello"},
{"role": "assistant", "content": [{"type": "text", "text": "there"}]},
{"role": "user", "content": "how"},
{"role": "assistant", "content": [{"type": "text", "text": "are you doing?"}]},
{"role": "user", "content": "very very very very very very long string"},
]
context_handling = transform_messages.TransformMessages(
transforms=[
transforms.MessageHistoryLimiter(max_messages=3),
transforms.MessageTokenLimiter(max_tokens=1000, max_tokens_per_message=3),
],
)
context_handling._transform_messages(messages)
To print the stats for all transformations, or not at all.
Screenshots and logs
No response
Additional Information
The TransformMessages._print_stats problem is caused by the fact that: if pre_transform_messages_len < post_transform_messages_len: should be if post_transform_messages_len < pre_transform_messages_len:
The text was updated successfully, but these errors were encountered:
Describe the bug
The
MessageTokenLimiter
prints the number of tokens truncated, while theMessageHistoryLimiter
doesn't print the number of messages removed. Also, theTransformMessages._print_stats
method isn't working.Steps to reproduce
Execute the following code:
(code based on #2247)
Model Used
No model used
Expected Behavior
To print the stats for all transformations, or not at all.
Screenshots and logs
No response
Additional Information
The
TransformMessages._print_stats
problem is caused by the fact that:if pre_transform_messages_len < post_transform_messages_len:
should beif post_transform_messages_len < pre_transform_messages_len:
The text was updated successfully, but these errors were encountered: