Minor improvements for title generation #870
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Jeffry,
I know the title generation issues have already been addressed by you for a few times, but I've seen issue #773 and wanted to add some final fixes.
A limit of 50 tokens for generation is quite generous, as that would equal a maximum title length of up to 37,5 words of pure text - just for a title! On the other hand, tokens for special characters are used up way faster, so the number of tokens to generate should never be lower than the maximum title length in characters.
This commit adds title length clamping to 30 characters with dots (...) added if text gets too long. The maximum tokens generated are 31 (30 for the title + 1 for the emoji).
It also features some minor re-factoring for better maintainability of the prompts and amount of tokens into
constants.py.Hope you're having a lovely day.