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

Enable custom token counting #7263

Open
luisquintanilla opened this issue Oct 7, 2024 · 0 comments
Open

Enable custom token counting #7263

luisquintanilla opened this issue Oct 7, 2024 · 0 comments
Labels
enhancement New feature or request untriaged New issue has not been triaged

Comments

@luisquintanilla
Copy link
Contributor

Currently, Tokenizer returns counts strictly based on tokens.

However, there are scenarios where library authors may want / need to implement their own custom token counting function.

One such scenario is providing token counts for image inputs. In such cases, AI service providers provide an arbitrary way of calculating cost based on a fixed token count.

Provider Cost calculations Does tokenization Link
OpenAI Fixed No https://platform.openai.com/docs/guides/vision/calculating-costs
Claude Fixed No https://docs.anthropic.com/en/docs/build-with-claude/vision#calculate-image-costs
Gemini Fixed No https://ai.google.dev/gemini-api/docs/tokens?lang=python#multimodal-tokens
Cohere N/A N/A https://docs.cohere.com/docs/tokens
Mistral N/A N/A https://docs.mistral.ai/guides/tokenization/#tokens-count
@luisquintanilla luisquintanilla added the enhancement New feature or request label Oct 7, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request untriaged New issue has not been triaged
Projects
None yet
Development

No branches or pull requests

1 participant