Skip to content
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

[Feature Request] Add a token cutoff #94

Closed
Reledia opened this issue Apr 10, 2024 · 11 comments
Closed

[Feature Request] Add a token cutoff #94

Reledia opened this issue Apr 10, 2024 · 11 comments
Labels
feature request New feature or request good first issue Good for newcomers

Comments

@Reledia
Copy link

Reledia commented Apr 10, 2024

Hello. Sometimes, some pages I save contains essays or stories that can span aboce 20k+ tokens. This does not only used much more credits/money when doing a request, but it consumes a lot of time (from 4s to >50s) and the prompt get lost in the way.

Would it be possible to add an env variable so we can set the max number of tokens to send in a single request?

@MohamedBassem
Copy link
Collaborator

Hi, there's already a hardcoded token cutoff of 1500 tokens (to fit in the context window of some models). But making this configurable makes a ton of sense :) Should be easy to implement and include in the next release. Thanks for the suggestion!

@MohamedBassem MohamedBassem added feature request New feature or request good first issue Good for newcomers labels Apr 11, 2024
@Reledia
Copy link
Author

Reledia commented Apr 11, 2024

I'm happy to hear this was already implemented, but I observe a different thing in my logs

Screenshot_20240411_125943_Vivaldi.jpg

My version of hoarder should be the latest available

@MohamedBassem
Copy link
Collaborator

Oh wow, that's a lot of tokens. Hmmm, I have a guess. I'm currently approximating tokens to words. So technically speaking I'm truncating the content to 1500 words not tokens. Maybe that's where the difference is coming from? Do you have a link that you are willing to share for me to debug this? Thanks!

@Reledia
Copy link
Author

Reledia commented Apr 11, 2024

I don't wanna share the actual link because it's very explicit, but it was a chapter of a fanfiction from AO3, so very heavy on words

@MohamedBassem
Copy link
Collaborator

Turned out, I had a bug in the content truncating logic. Sending a fix now.

@Reledia
Copy link
Author

Reledia commented Apr 15, 2024

By looking at the commit, was the truncate function sending words only after the 1500th one?

@MohamedBassem
Copy link
Collaborator

Yeah, noob mistake :)

@Reledia
Copy link
Author

Reledia commented Apr 15, 2024

Dont worry, it happens to everyone :)
But maybe in the next release it would be better to inform users to re-process all previous bookmarks?

@MohamedBassem
Copy link
Collaborator

The bug only affects bookmarks with content larger than 1500 though, so it's not all bad. I'll mention it in the release note and let people decide whether they want to re-process or not (given that re-processing can be expensive for those using openai for example).

@Reledia
Copy link
Author

Reledia commented Apr 15, 2024

Seems like the best solution. Thanks for the time

@MohamedBassem
Copy link
Collaborator

Hotfix 0.12.1 released with the fix. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants