Local Tokenizer
[Experimental] Text Only Local Tokenizer.
This class provides a local tokenizer for text only token counting.
LIMITATIONS:
- Only supports text based tokenization and no multimodal tokenization.
- Forward compatibility depends on the open-source tokenizer models for future Gemini versions.
NOTE: The SDK's local tokenizer implementation is experimental and may change in the future. It only supports text based tokenization.
Functions
Link copied to clipboard
Computes the token ids and string pieces for a single content object.
Computes the token ids and string pieces for a text string.
Computes the tokens ids and string pieces in the input.
Link copied to clipboard
Counts the number of tokens in a single content object using default configuration.
Counts the number of tokens in a text string using default configuration.
Counts the number of tokens in a list of content objects using default configuration.
Counts the number of tokens in a single content object.
Counts the number of tokens in a text string.
Counts the number of tokens in a given text.