transforms
autogen.agentchat.contrib.capabilities.transforms.TextMessageCompressor
TextMessageCompressor
A transform for compressing text messages in a conversation history.
It uses a specified text compression method to reduce the token count of messages, which can lead to more efficient
processing and response generation by downstream models.
Name | Description |
---|---|
text_compressor | Type: autogen.agentchat.contrib.capabilities.text_compressors.TextCompressor | None Default: None |
min_tokens | Type: int | None Default: None |
compression_params | Type: dict Default: {} |
cache | Type: autogen.cache.abstract_cache_base.AbstractCache | None Default: None |
filter_dict | Type: dict | None Default: None |
exclude_filter | Type: bool Default: True |
Instance Methods
apply_transform
Applies compression to messages in a conversation history based on the specified configuration.
The function processes each message according to the compression_args
and min_tokens
settings, applying
the specified compression configuration and returning a new list of messages with reduced token counts
where possible.
Name | Description |
---|---|
messages | A list of message dictionaries to be compressed. Type: list[dict] |
Type | Description |
---|---|
list[dict] | List[Dict]: A list of dictionaries with the message content compressed according to the configured method and scope. |
get_logs
Name | Description |
---|---|
pre_transform_messages | Type: list[dict] |
post_transform_messages | Type: list[dict] |