Metadata-Version: 2.4
Name: ragpy-core
Version: 1.0.10
Summary: A modular Retrieval-Augmented Generation (RAG) pipeline for Python.
Author: William Klusman
Author-email: William Klusman <klusmannwilliam@gmail.com>
License: MIT License
        
        Copyright (c) 2026 William Klusman
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the “Software”), to deal
        in the Software without restriction, including without limitation the rights  
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  
        copies of the Software, and to permit persons to whom the Software is  
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in  
        all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING  
        FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER  
        DEALINGS IN THE SOFTWARE.
Keywords: RAG,retrieval-augmented-generation,LLM,vector-database,azure-openai,machine-learning,nlp
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: chromadb>=0.4.0
Requires-Dist: numpy>=1.20
Requires-Dist: tiktoken>=0.5.0
Requires-Dist: requests>=2.0
Requires-Dist: openai>=1.0.0
Requires-Dist: pypdf>=4.0.0
Dynamic: author
Dynamic: license-file
Dynamic: requires-python

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, PDF, and DOCX documents
• Deterministic 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

From PyPI:
pip install ragpy

Quickstart Example

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, PDF, or DOCX 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

Reduce token usage while preserving grounding

Answer Generation

Build a prompt using compressed context

Generate a grounded answer using Azure OpenAI

Project Structure

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
• python-docx
• 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:
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.
