simonw / ttok

Count and truncate text based on tokens
Apache License 2.0
248 stars 7 forks source link

Verbose option #5

Open faroukfaiz10 opened 1 year ago

faroukfaiz10 commented 1 year ago

What

The truncating text feature could make use of a --verbose option to display if text has been truncated (has exceeded the truncation limit), and maybe how many tokens are left.

Why

It can be useful to know if the text has effectively been truncated, as a warning that not all text has passed through, and maybe another pass is needed for the rest of the text.

I can see people using ttok as safeguard before all their LLM API calls to avoid hitting the API tokens limits. When that limit is high and not expected to be hit, having a warning when it does will come in handy.

Notes

The logged warning should not be part of the stdout of ttok which is expected to be piped. Maybe stderr would fit more here.