totokenizers
A model-agnostic library to encode text into tokens and couting them using different tokenizers.
install
pip install totokenizers
usage
from totokenizers.factories import TotoModelInfo, Totokenizer
model = "openai/gpt-3.5-turbo-0613"
desired_max_tokens = 250
tokenizer = Totokenizer.from_model(model)
model_info = TotoModelInfo.from_model(model)
thread_length = tokenizer.count_chatml_tokens(thread, functions)
if thread_length + desired_max_tokens > model_info.max_tokens:
raise YourException(thread_length, desired_max_tokens, model_info.max_tokens)
Metadata
Release files for totokenizers 1.9.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| totokenizers-1.9.3.tar.gz | 757.0 kB | Without provenance | Details for totokenizers-1.9.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| totokenizers-1.9.3-py3-none-any.whl | Python 3 | none | any | Details for totokenizers-1.9.3-py3-none-any.whl |
Total release size: 1.5 MB
Release files / totokenizers-1.9.3.tar.gz
| Download URL | totokenizers-1.9.3.tar.gz |
|---|---|
| Size | 757.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7d86dc92497f5853b6e60c44fc4e981fc27166a552091608d77713f07f71db9
|
|
BLAKE2b-256 checksum How to use checksums |
d6838ce861b59317ae08b7492ff6a010d1f53e4817ef3802da6d64bf6d3ffdc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / totokenizers-1.9.3-py3-none-any.whl
| Download URL | totokenizers-1.9.3-py3-none-any.whl |
|---|---|
| Size | 767.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39069a33c95a88ca388a4886b1c781441d7a6f1e1b9d5a07e169836a9b97af89
|
|
BLAKE2b-256 checksum How to use checksums |
afc74cf8e2b372a5224181778b82fe890d870805e170b789910aab7c6c1fae11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for totokenizers 1.9.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.