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

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!")


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="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"                   # or "sk-your-openai-key" if using OpenAI
)

print("\n✅ Pipeline executed successfully!")

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.0.tar.gz (25.0 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.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ragchunker-0.1.0.tar.gz
  • Upload date:
  • Size: 25.0 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.0.tar.gz
Algorithm Hash digest
SHA256 df937e6faa81e046793c9a3fd9db031c5b43d6ec7404a66c2a635e089d43185c
MD5 3724f5fdde871704797ee70f491a82ba
BLAKE2b-256 32cb6d265010f4623c1cec4af74f7bba119b26ff8a96d0e9fbc8212ad589c1f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ragchunker-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4011740dbd6c0e5099a5088f976ab776281188d997ca9d8c12fd3210e9261f0
MD5 f36cf1795070fe2c9e52278e764a5d50
BLAKE2b-256 007f94add6a536ed05b023e938ffc92fbd26fd47a370b6df900440e5a37717ab

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