Skip to main content

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

VECTOR_DB = "chroma"  # "faiss" or "chroma"


## 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.4.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ragchunker-0.1.4-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file ragchunker-0.1.4.tar.gz.

File metadata

  • Download URL: ragchunker-0.1.4.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

Hashes for ragchunker-0.1.4.tar.gz
Algorithm Hash digest
SHA256 e6cf4e3630919268bb527d8fbe6c6b068b8bb7807907ea33e894665559355ae9
MD5 90a8733a63fe999dcfe6b8f59084ed0a
BLAKE2b-256 ba29dc9cc81cb71f67a36611f50ba6fc8bc5cbe1d6bec24a875d92088cccc6da

See more details on using hashes here.

File details

Details for the file ragchunker-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: ragchunker-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for ragchunker-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ac675efbec609d4658b3501f65d621184f05605b4b98d020d1832fe8a697cf55
MD5 bfada81f8ecc422e95d18d4798c79ec9
BLAKE2b-256 61ba7d27ddbdd2c955ff37a878251fea2fed1f2e61e81bfd7b77189cd96a1c72

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page