Skip to content

Add tests for LastMaxTokenSizeContentPurger #3293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jhl221123
Copy link

Hi team,

This PR introduces unit tests for LastMaxTokenSizeContentPurger, following up on the discussion in issue #2894.

While working on the tests, I encountered a particular scenario regarding the totalSize parameter that I'd like to clarify. It seems that if totalSize is passed in with a value smaller than the actual sum of estimateTokenCount for the List<MediaContent> datum, the current logic might not perform the expected purging.

For example, if datum contains items with token counts (total 120), and purgeExcess() is called with totalSize (100) and maxTokenSize (100), the initial while loop condition (totalSize > this.maxTokenSize) would be false. Consequently, no items from datum would be purged, potentially leading to the final token count exceeding maxTokenSize.

Is this behavior intended, or is there something I might be overlooking regarding how totalSize is expected to be calculated and passed to this method?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants