Skip to main content

TextCompressor

Defines a protocol for text compression to optimize agent interactions. Parameters:

Instance Methods

compress_text

This method takes a string as input and returns a dictionary containing the compressed text and other relevant information. The compressed text should be stored under the ‘compressed_text’ key in the dictionary.
To calculate the number of saved tokens, the dictionary should include ‘origin_tokens’ and ‘compressed_tokens’ keys.
Parameters: