ChromaDB Data Pipes 🖇️ - The easiest way to get data into and out of ChromaDB
Project description
ChromaDB Data Pipes 🖇️ - The easiest way to get data into and out of ChromaDB
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/chroma-qna" --upsert --create
Importing from a directory with PDF files into Local Persisted Chroma DB:
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://chroma-data/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 themy-pdfs
collection in Chroma DB.
Exporting
Export data from Local Persisted 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://chroma-data/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.
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 thecdp exp hf
command.
cdp exp chroma --uri "http://localhost:8000/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/chroma-qna" --limit 10 --offset 10 | cdp exp hf --uri "file://chroma-qna"
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/chroma-qna" | cdp tx embed --ef default | cdp imp chroma --uri "http://localhost:8000/chroma-qna-def-emb" --upsert --create
Note: See Embedding Processors for more info about supported embedding functions.
Import dataset from HF to Local Persisted Chroma and embed the documents:
cdp imp hf --uri "hf://tazarov/ds2?split=train" | cdp tx embed --ef default | cdp imp chroma --uri "file://chroma-data/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/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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a086b898194d3596b53deae68b0b8f2ea6f377e11e139d838301a060602a3536 |
|
MD5 | 7017dce822a6fe923e13f691ba78cb6c |
|
BLAKE2b-256 | 589579fb349ad6b20c462e34fbea2c4a13b7b759f8e5ece8bc1c1fcfbc4cb0e9 |
Hashes for chromadb_data_pipes-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d051212fb972e5f70b5b159d4e9cb4219137d824e202309a6cad9702c58304c0 |
|
MD5 | b7e9fc22611162bce77ae924a047718c |
|
BLAKE2b-256 | e8d3abde8b4416e385e034065cd9454352dda3a2da4dfc7729ac4eeb8665855e |