Chroma DB Data Pipes is a collection of tools for working with data in Chroma DB and building RAG systems
Project description
ChromaDB Data Pipes 🖇️| Rediscover AI/ML the Unix Way
ChromaDB Data Pipes is a collection of tools to build data pipelines for Chroma DB, inspired by the Unix philosophy of " do one thing and do it well".
Roadmap:
- Integration with LangChain 🦜🔗
- Integration with LlamaIndex 🦙
- Support more than
all-MiniLM-L6-v2
as embedding functions - Multimodal support
- Much more!
Installation
pip install chromadb-data-pipes
Usage
Get help:
cdp --help
Importing
Import data from HuggingFace Datasets to .jsonl
file:
cdp imp hf --uri "hf:tazarov/chroma-qna?split=train" > chroma-qna.jsonl
Import data from HuggingFace Datasets to Chroma DB:
The below command will import the train
split of the given dataset to Chroma chroma-qna chroma-qna
collection. The
collection will be created if it does not exist and documents will be upserted.
cdp imp hf --uri "hf://tazarov/chroma-qna?split=train" | cdp imp chroma --uri "http://localhost:8000/default_database/chroma-qna" --upsert --create
Importing from a directory with PDF files:
cdp imp pdf sample-data/papers/ |grep "2401.02412.pdf" | head -1 | cdp tx chunk -s 500 | cdp tx embed --ef default | cdp imp chroma --uri "http://localhost:8000/default_database/my-pdfs" --upsert --create
!!! note
The above command will import the first PDF file from the `sample-data/papers/` directory, chunk it into 500 word
chunks, embed each chunk and import the chunks to the `my-pdfs` collection in Chroma DB.
Exporting
Export data from Chroma DB to .jsonl
file:
The below command will export the first 10 documents from the chroma-qna
collection to chroma-qna.jsonl
file.
cdp exp chroma --uri "http://localhost:8000/default_database/chroma-qna" --limit 10 > chroma-qna.jsonl
Export data from Chroma DB to HuggingFace Datasets:
The below command will export the first 10 documents with offset 10 from the chroma-qna
collection to HuggingFace
Datasets tazarov/chroma-qna
dataset. The dataset will be uploaded to HF.
!!! note HF Auth and Privacy
Make sure you have `HF_TOKEN=hf_....` environment variable set.
If you want your dataset to be private, add `--private` flag to the `cdp exp hf` command.
cdp exp chroma --uri "http://localhost:8000/default_database/chroma-qna" --limit 10 --offset 10 | cdp exp hf --uri "hf://tazarov/chroma-qna-modified"
To export a dataset to a file, use --uri
with file://
prefix:
cdp exp chroma --uri "http://localhost:8000/default_database/chroma-qna" --limit 10 --offset 10 | cdp exp hf --uri "file://chroma-qna"
!!! note File Location
The file is relative to the current working directory.
Processing
Copy collection from one Chroma collection to another and re-embed the documents:
cdp exp chroma --uri "http://localhost:8000/default_database/chroma-qna" | cdp tx embed --ef default | cdp imp chroma --uri "http://localhost:8000/default_database/chroma-qna-def-emb" --upsert --create
Import dataset from HF to Chroma and embed the documents:
cdp imp hf --uri "hf://tazarov/ds2?split=train" | cdp tx embed --ef default | cdp imp chroma --uri "http://localhost:8000/default_database/chroma-qna-def-emb-hf" --upsert --create
Chunk Large Documents:
cdp imp pdf sample-data/papers/ | grep "2401.02412.pdf" | head -1 | cdp tx chunk -s 500
Misc
Count the number of documents in a collection:
cdp exp chroma --uri "http://localhost:8000/default_database/chroma-qna" | wc -l
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for chromadb_data_pipes-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 006355d79b8ab78f5ca9002f0cd97ae773d4d86f8016ba49596784a377d5cbff |
|
MD5 | f5122e191af9a7246fc27a950ee62696 |
|
BLAKE2b-256 | bc906a40331084e04e55cd7549c112e948730f4ee48e24cad0b30487e78bb0b4 |
Hashes for chromadb_data_pipes-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23dd8c869e1d83a41560eccc5861df82af0917e4cad38c73151ad74600dd5bbf |
|
MD5 | c0c69386ed975fbbeb73dbef6aa5e171 |
|
BLAKE2b-256 | ef19263562cc221959a21846106fa3e533c0db3ff34e58c6256402d10fa48aa7 |