-
Notifications
You must be signed in to change notification settings - Fork 0
log character counts and estimated tokens #30
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
Conversation
b4dc8d4
to
a925a35
Compare
a925a35
to
64e9e3d
Compare
"Tool {} loaded with a character count of {}. Estimated tokens: {}", | ||
operation_name, | ||
length, | ||
length / 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it dividing by 4 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I found it here - "For Claude, a token approximately represents 3.5 English characters". If that's the case, let's get a comment in here explaining the computation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, 4 was the magical number that everyone seems to say is a reasonable estimate across models. I'll add a comment 👍
Logs the character size of each tool as it loads, logs the total character length of all tools and an estimate of the tokens (seems like ~4 characters is roughly a token, but will obviously vary)
Formatting I have right now, definitely open to suggestions to make it better