A lightweight RAG chunking and preprocessing library
Project description
ragchunker
A modular Python package for Retrieval-Augmented Generation (RAG) preprocessing. It supports:
- File Ingestion: Load documents from various formats (TXT, PDF, DOCX, PPTX, images with OCR, audio with Whisper, CSV/Excel/Parquet, HTML, JSON, ZIP/TAR).
- Chunking: Split documents into chunks using fixed-length, semantic, or recursive strategies.
- Provenance: Track metadata, checksums, and token counts for chunks.
- Embeddings: Generate embeddings using Sentence-Transformers or OpenAI.
- Storage: Save chunks and embeddings to JSONL, Parquet, SQLite, NumPy, or FAISS; optional integration with Pinecone or ChromaDB.
Installation
Install the core package:
pip install ragchunker
For Testing:
from ragchunker.rag_pipeline import run_rag_pipeline
from ragchunker.storage import store_from_result
## For Open Source Embeddings
result = run_rag_pipeline(
data_dir="data", # Folder with your PDFs, docs, or txt files
output_dir="output", # Where JSONL, Chunks and embeddings will be saved
chunk_strategy="semantic", # or "fixed", "recursive"
chunk_size=800,
overlap=100,
embed_model="all-MiniLM-L6-v2", # or any other
embed_provider="sentence-transformers",
openai_api_key=None # or "sk-your-openai-key" if using OpenAI
)
print("\n✅ Pipeline executed successfully!")
# For Open AI Embeddings
result = run_rag_pipeline(
data_dir="data", # Folder with your PDFs, docs, or txt files
output_dir="output", # Where JSONL, Chunks and embeddings will be saved
chunk_strategy="semantic", # or "fixed", "recursive"
chunk_size=800,
overlap=100,
embed_model="text-embedding-3-small", # or any other
embed_provider="openai",
openai_api_key="" # or "sk-your-openai-key" if using OpenAI
)
print("\n✅ Pipeline executed successfully!")
print(f"\nStoring embeddings + chunks to: {VECTOR_DB}")
store_info = store_from_result(result, VECTOR_DB)
print("Store info:", store_info)
print("Done.")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ragchunker-0.1.3.tar.gz
(27.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ragchunker-0.1.3.tar.gz.
File metadata
- Download URL: ragchunker-0.1.3.tar.gz
- Upload date:
- Size: 27.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
791fffdaf804341f21b362b9ac5508e5692448682514e27712c68ea37ec3dccf
|
|
| MD5 |
68f6edbecf7f888455bd8756ea73d11e
|
|
| BLAKE2b-256 |
ad24a7fc103f939e2853b2f098980acf5b51d72d845fbec0178995bb1011e41c
|
File details
Details for the file ragchunker-0.1.3-py3-none-any.whl.
File metadata
- Download URL: ragchunker-0.1.3-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3c73bbbf66d06f557b8149b99f140e4df8d7324e531482ecc3fa4cb82af2bbc
|
|
| MD5 |
1b7b0e9d668d6ffe882411b3685a9c51
|
|
| BLAKE2b-256 |
c4a7350a9e78b3397053e89fc4b84a44c7f76a1d9e77924d26d40e890f30a6e3
|