← Back to all products
$59
RAG Pipeline Framework
Complete retrieval-augmented generation pipeline with document ingestion, chunking strategies, vector store integration, and evaluation.
MarkdownYAMLPythonLLMOpenAI
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 44 files
rag-pipeline-framework/
├── LICENSE
├── README.md
├── configs/
│ └── pipeline_config.yaml
├── free-sample.zip
├── guide/
│ ├── 01-chunking-strategy-guide.md
│ └── 02-retrieval-tuning-guide.md
├── guides/
│ ├── chunking-strategy-guide.md
│ └── retrieval-tuning-guide.md
├── index.html
├── requirements.txt
├── src/
│ ├── __init__.py
│ ├── __pycache__/
│ │ ├── __init__.cpython-312.pyc
│ │ ├── embeddings.cpython-312.pyc
│ │ ├── models.cpython-312.pyc
│ │ ├── orchestrator.cpython-312.pyc
│ │ └── vector_store.cpython-312.pyc
│ ├── chunking/
│ │ ├── __init__.py
│ │ ├── __pycache__/
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ └── strategies.cpython-312.pyc
│ │ └── strategies.py
│ ├── embeddings.py
│ ├── evaluation/
│ │ ├── __init__.py
│ │ └── __pycache__/
│ │ └── __init__.cpython-312.pyc
│ ├── loaders/
│ │ ├── __init__.py
│ │ ├── __pycache__/
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ ├── base_loader.cpython-312.pyc
│ │ │ ├── html_loader.cpython-312.pyc
│ │ │ ├── pdf_loader.cpython-312.pyc
│ │ │ └── text_loader.cpython-312.pyc
│ │ ├── base_loader.py
│ │ ├── html_loader.py
│ │ ├── pdf_loader.py
│ │ └── text_loader.py
│ ├── models.py
│ ├── orchestrator.py
│ ├── retrieval/
│ │ ├── __init__.py
│ │ ├── __pycache__/
│ │ │ ├── __init__.cpython-312.pyc
│ │ │ └── reranker.cpython-312.pyc
│ │ └── reranker.py
│ └── vector_store.py
└── tests/
├── __pycache__/
│ ├── conftest.cpython-312.pyc
│ └── test_pipeline.cpython-312.pyc
├── conftest.py
└── test_pipeline.py
📖 Documentation Preview README excerpt
RAG Pipeline Framework
A modular retrieval-augmented generation framework with pluggable loaders, chunking strategies, embedding backends, vector stores, hybrid search, reranking, and a full evaluation suite.
Build a RAG pipeline that actually works. Not a toy demo — a framework with four chunking strategies, BM25+dense hybrid search, reranking, and RAGAS-style evaluation metrics, all runnable locally with the included in-memory vector store.
What You Get
- Document loaders for plain text, Markdown, HTML, and PDF with metadata extraction
- Four chunking strategies — fixed-size, recursive text splitting, semantic (embedding-based topic detection), and sentence-window
- Embedding abstraction with OpenAI adapter and a deterministic demo embedder for offline testing
- Embedding cache that persists to disk so re-indexing unchanged documents costs nothing
- In-memory vector store with full BM25 keyword search — runs the complete pipeline with zero external services
- Hybrid search combining dense similarity and BM25 via Reciprocal Rank Fusion
- Reranking with a cross-encoder API adapter and a stdlib keyword-boost alternative
- RAG orchestrator that wires retrieval + generation into a single
query()call - Evaluation suite measuring context precision, context recall, faithfulness, and answer relevancy
- YAML configuration for every pipeline parameter
- Comprehensive test suite covering loaders, chunkers, embeddings, retrieval, and evaluation
- Strategy guides for chunking selection and retrieval tuning
File Tree
rag-pipeline-framework/
├── README.md
├── LICENSE
├── requirements.txt
├── src/
│ ├── __init__.py
│ ├── models.py # Document, Chunk, RetrievalResult dataclasses
│ ├── orchestrator.py # RAG query orchestrator
│ ├── embeddings.py # Embedding abstraction (OpenAI + demo + cache)
│ ├── vector_store.py # Vector store interface + in-memory BM25 impl
│ ├── loaders/
│ │ ├── __init__.py
│ │ ├── base_loader.py # Abstract loader interface
│ │ ├── text_loader.py # Plain text + Markdown loaders
│ │ ├── html_loader.py # HTML loader (stdlib html.parser)
│ │ └── pdf_loader.py # PDF loader (pypdf/PyPDF2)
│ ├── chunking/
│ │ ├── __init__.py
│ │ └── strategies.py # Fixed, Recursive, Semantic, SentenceWindow
│ ├── retrieval/
│ │ ├── __init__.py
│ │ └── reranker.py # CrossEncoder + KeywordBoost rerankers
│ └── evaluation/
│ └── __init__.py # RAGAS-style evaluation metrics + reporting
├── configs/
│ └── pipeline_config.yaml # Full pipeline configuration
├── tests/
│ ├── conftest.py # Path setup
│ └── test_pipeline.py # Comprehensive test suite
└── guides/
├── chunking-strategy-guide.md # When to use each strategy + tuning
└── retrieval-tuning-guide.md # Dense vs hybrid, reranking, top-k selection
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
src/embeddings.py
"""
Embedding Abstraction Layer — RAG Pipeline Framework
=====================================================
Provides a unified interface for embedding text into dense vectors.
Ships with an OpenAI adapter and a random-vector demo backend so
you can run the full pipeline without an API key during development.
The abstraction lets you swap embedding providers (OpenAI, Cohere,
HuggingFace sentence-transformers, local ONNX) without changing
any pipeline code.
By Datanest Digital — support@datanest.dev
"""
from __future__ import annotations
import hashlib
import json
import logging
import random
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Dict, List, Optional
from src.models import Chunk
logger = logging.getLogger(__name__)
class BaseEmbedder(ABC):
"""Abstract interface for text embedding backends.
Subclasses must implement ``embed_texts`` which takes a batch of
strings and returns the corresponding embedding vectors.
Args:
dimension: Expected embedding dimension. Used by vector stores
for index configuration and by the demo embedder to generate
correctly-sized random vectors.
batch_size: How many texts to embed in a single API call.
Larger batches are cheaper (fewer round-trips) but use
more memory.
"""
def __init__(self, dimension: int = 1536, batch_size: int = 64) -> None:
self.dimension = dimension
self.batch_size = batch_size
@abstractmethod
def embed_texts(self, texts: List[str]) -> List[List[float]]:
# ... 218 more lines ...