Samples
Tokenize text
{5432, 8754, 389, 264, 8147, 4729}
Count tokens
Arguments
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
model | TEXT | - | ✔ | Cohere model for tokenization |
text_input | TEXT | - | ✔ | Text to tokenize |
api_key | TEXT | NULL | ✖ | Cohere API key |
api_key_name | TEXT | NULL | ✖ | Name of secret containing the API key |
verbose | BOOLEAN | FALSE | ✖ | Enable verbose logging |
Returns
INT[]: Array of token IDs.
Related functions
cohere_detokenize(): convert tokens back to text