A modular Retrieval-Augmented Generation (RAG) pipeline for Python.
Project description
RAGpy RAGpy is a lightweight, modular Retrieval-Augmented Generation (RAG) pipeline for Python. It provides a clear and testable architecture for document ingestion, chunking, embedding, retrieval, reranking, context compression, and grounded answer generation using Azure OpenAI and ChromaDB.
RAGpy is designed for developers who want a transparent, hackable RAG system without the complexity of large frameworks.
Features Modular ingestion pipeline for text and PDF documents
Chunking and batching utilities for efficient embedding
Azure OpenAI embeddings and chat completions
ChromaDB vector database integration
LLM-based reranking for improved retrieval quality
Context compression to reduce token usage
Fully monkeypatch-friendly design for offline testing
Clean architecture suitable for extension and customization
Installation Once published to PyPI:
Code pip install ragpy For development:
Code git clone https://github.com/yourusername/ragpy cd ragpy pip install -e . Quickstart Example python from ragpy.RAGOrchestrator import IngestFile, GenerateAnswer from ragpy.VectorDatabase import OpenDatabase
OpenDatabase("AeroDB", "./vectorDB") IngestFile("engine_vibration.pdf", "AeroDB")
answer = GenerateAnswer("What causes engine vibration?", "AeroDB") print(answer) How RAGpy Works
- Ingestion Load text or PDF using FileLoader
Chunk text using TextChunker
Batch chunks using ChunkBatcher
Generate embeddings with Azure OpenAI
Store vectors and metadata in ChromaDB
- Retrieval Embed the user query
Retrieve top-K candidates from the vector database
-
Reranking Use an LLM-based reranker to reorder retrieved chunks by relevance
-
Compression Summarize top chunks into a compact context block
-
Answer Generation Build a prompt using compressed context
Generate a grounded answer using Azure OpenAI
Project Structure Code ragpy/ AzureOpenAIRelay.py RAGOrchestrator.py VectorDatabase.py Reranker.py ChunkCompressor.py loaders/ FileLoader.py TextChunker.py batching/ ChunkBatcher.py tests/ docs/ Requirements Python 3.9+
ChromaDB
numpy
tiktoken
pypdf
openai (Azure OpenAI SDK)
Testing RAGpy includes a full pytest suite. All Azure calls are monkeypatch-friendly, allowing offline testing with mock LLMs.
Run tests:
Code pytest -q Contributing Contributions are welcome. Please open an issue or submit a pull request on GitHub.
Planned enhancements include:
Local embedding support (sentence-transformers)
Hybrid retrieval (vector + keyword)
Multimodal RAG (image + text)
Evaluation tools for relevance and faithfulness
Agentic RAG extensions
License RAGpy is released under the MIT License.
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
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 ragpy_core-1.0.0.tar.gz.
File metadata
- Download URL: ragpy_core-1.0.0.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07d01f1d597e068e07511517cd1bc34aae4467c4ed9f0bcfffc7af8bd156c0e8
|
|
| MD5 |
6e0925541110213a1e5505554bfbcfc9
|
|
| BLAKE2b-256 |
d14fd7224edde44694bf769ae5c492bf41c32d4c9da4787fca6b8a211284a5dc
|
File details
Details for the file ragpy_core-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ragpy_core-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5273e6d4a73d28d60ee7d22ec5a704ca0878983423697aca03e7d0e0f1d01ad6
|
|
| MD5 |
0e7cc714e3ff70ea518f97fc9628ba0f
|
|
| BLAKE2b-256 |
66c87cc5c3b9c62d9e6625f5b056439a9ab65049437d802a345bd89e1a4a625f
|