This release is a pre-release and may not be stable for production use.
🦛 Chonkie
so i found myself making another RAG bot (for the 2342148th time) and meanwhile, explaining to my juniors about why we should use chunking in our RAG bots, only to realise that i would have to write chunking all over again unless i use the bloated software library X or the extremely feature-less library Y. WHY CAN I NOT HAVE GOOD THINGS IN LIFE, UGH?
Can't i just install, import and run chunking and not have to worry about dependencies, bloat, speed or other factors?
Well, with chonkie you can! (chonkie boi is a gud boi)
✅ All the CHONKs you'd ever need
✅ Easy to use: Install, Import, CHONK
✅ No bloat, just CHONK
✅ Cute CHONK mascoot
✅ Moto Moto's favorite python library
What're you waiting for, just CHONK it!
Table of Contents
Why do we need Chunking?
Here are some arguments for why one would like to chunk their texts for a RAG scenario:
- Most RAG pipelines are bottlenecked by context length as of today. While we expect future LLMs to exceed 1Mill token lenghts, even then, it's not only LLMs inside the pipeline, but other aspects too, namely, bi-encoder retriever, cross-encoder reranker and even models for particular aspects like answer relevancy models and answer attribution models, that could lead to the context length bottleneck.
- Even with infinite context, there's no free lunch on the context side - the minimum it takes to understand a string is o(n) and we would never be able to make models more efficient on scaling context. So, if we have smaller context, our search and generation pipeline would be more efficient (in response latency)
- Research suggests that a lot of random, noisy context can actually lead to higher hallucination in the model responses. However, if we ensure that each chunk that get's passed onto the model is only relevant, the model would end up with better responses.
Quick CHONK!
Installation
To install chonkie, simply run:
pip install chonkie
Chonkie follows the rule to have minimal defualt installs, read the DOCS to know the installation for your required chunker, or simply install all if you don't want to think about it (not recommended).
pip install chonkie[all]
Usage
Here's a basic example to get you started:
from chonkie import TokenChunker
# Initialize the chunker
chunker = TokenChunker()
# Chunk some text
chunks = chunker("Your text here")
print(chunks)
More example usages given inside the DOCS
Citation
If you use Chonkie in your research, please cite it as follows:
@misc{chonkie2024,
author = {Minhas, Bhavnick},
title = {Chonkie: A Lightweight Chunking Library for RAG Bots},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/bhavnick/chonkie}},
}
Metadata
Release files for chonkie 0.0.1a8
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 |
|---|---|---|---|---|
| chonkie-0.0.1a8.tar.gz | 15.5 kB | Without provenance | Details for chonkie-0.0.1a8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chonkie-0.0.1a8-py3-none-any.whl | Python 3 | none | any | Details for chonkie-0.0.1a8-py3-none-any.whl |
Total release size: 32.8 kB
Release files / chonkie-0.0.1a8.tar.gz
| Download URL | chonkie-0.0.1a8.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97caeca8d7c6f90f462ffa3023acf59b2a3880e9849e433432bdd9f33df028ed
|
|
BLAKE2b-256 checksum How to use checksums |
b2d390c87ec41853584ec2a4ed5e710a2e21d165143118be5a9b965d834f5f4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Release files / chonkie-0.0.1a8-py3-none-any.whl
| Download URL | chonkie-0.0.1a8-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd991c4f46a1ed98076ce0fe7f154359739d4eae074c29b9437924e6d8b8fac9
|
|
BLAKE2b-256 checksum How to use checksums |
dcbd95851b6af998e8480beec7268a466915f89eac2549193da3d654ab4a95db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Security for chonkie 0.0.1a8
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.