Add compression agent#131
Conversation
|
@kevin666aa I will take a look at this some time later today, thanks for posting this PR!👌 |
|
The test fails. |
|
@kevin666aa Let me know if this is still in draft or if it's ready for review |
in the build workflow. why |
|
I am currently testing this PR, it works for a bit but I eventually get this error. I have the following function defined in my code. |
|
@AaronWard @Siafu @sonichi I made several changes to the compression agent. I fix several bugs and revise the prompt. It would be great if you can try out the compression notebook and maybe test with your own examples? @Siafu Let me know if this fixes your issue. |
|
Does this PR affect the default behavior of the |
This PR will affect the default behavior at very minimal level: The newly registered Other than this, it will not affect default behavior at all. The compression is enabled only if the user wants to use the compression feature and passes in |
| logger.error(error_msg) | ||
| raise AssertionError(error_msg) | ||
|
|
||
| if messages is None: |
There was a problem hiding this comment.
Note: I removed the two lines here (need to confirm):
if messages is None:
messages = self._oai_messages[sender]
Why we can delete this:
The two lines deleted is in every generate_<>_reply function. So when both messages and sender are passed to a subsequent generate_<>_reply, it will perform the same logic.
final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"])
Why needed for compression: Compression will modify self._oai_messages, and it is expected that generate_oai_reply will use the updated messages from self._oai_messages. With the two lines, the messages will not be None and the updated self._oai_messages will not be used.
There was a problem hiding this comment.
Both justifications are not clear to me.
There was a problem hiding this comment.
Another option is to only remove this when compress_config is provided. This ensures the original logic is unchanged in the default seting
|
Is there an option of not altering |
testing now |
|
@kevin666aa Thanks for the nice PR. The compression feature is very important and asked by many users. But this PR involves changes of logic in |
@qingyun-wu this should be apparent with rigid and comprehensive unit testing. The impact of changes to the code should be measurable if there is any hope for longevity for any project. I can begin writing some tests but in all fairness ConversableAgent is pretty large so this should be a group effort |
|
@qingyun-wu @AaronWard I agree with both of you. We should add tests, and before we have the tests in place, let's be cautious when modifying the core. BTW @afourney is working on tests too. |
|
Thanks, then I will close this PR and add a compressible agent in the contrib first |
Why are these changes needed?
Add a compression feature in conversable_agent. By default, it will terminate the conversation if token count exceeds the max token count (To avoid token limit error). If compress_config is passed, it will start compressing and update conversation history when a certain token_count is reached.
Notes:
Related issue number
Checks