RAG_Type is a Python-based implementation of Retrieval-Augmented Generation (RAG) techniques, designed to enhance information retrieval and generation processes. This project focuses on adaptive retrieval, semantic chunking, hierarchical indexing, explainability, and feedback loops to improve the performance of RAG models.
-
Adaptive Retrieval
Dynamically adjusts the retrieval process based on the query requirements. -
Explainable Retrieval
Provides insights into why specific chunks or documents were retrieved. -
Feedback Loop Retrieval
Incorporates user feedback to iteratively refine retrieval and generation processes. -
Fusion Retrieval
Combines multiple retrieval strategies or sources for improved relevance and coverage. -
Hierarchical RAG
Uses a multi-level retrieval approach (e.g., sections, paragraphs) to match query depth effectively. -
Query Transform Retrieval
Reformulates user queries using paraphrasing or expansion for better document matching. -
Semantic RAG
Retrieves documents based on semantic similarity using embeddings rather than keyword matches. -
Self RAG
Enables the model to self-assess and refine its own retrieval outputs for enhanced accuracy. -
Simple RAG
A basic retrieval-augmented generation method using standard similarity-based retrieval.
File/Folder | Description |
---|---|
adaptive_retrieval.py |
Implements adaptive retrieval techniques. |
explainable_retrieval.py |
Adds explainability to the retrieval process. |
semantic_chunking.py |
Handles semantic chunking of documents. |
hierarchical_indices.py |
Builds hierarchical FAISS indices for document retrieval. |
fusion_retrieval.py |
Implements fusion-based retrieval strategies. |
feedback_loop.py |
Incorporates user feedback into the system. |
Main.py |
Main script to run the RAG pipeline. |
Eval.py |
Evaluation script for measuring model performance. |
Excel_save.py |
Saves evaluation results in Excel format. |
pdf_loader.py |
Loads PDF documents for processing. |
Understanding_Climate_Change.pdf |
Example dataset used for testing purposes. |
git clone https://github.com/vanshksingh/RAG_Type.git
cd RAG_Type
pip install -r requirements.txt
pip install faiss-cpu
- Load your dataset using
pdf_loader.py
. - Configure retrieval settings in the respective scripts (
adaptive_retrieval.py
, etc.). - Run the main pipeline:
python Main.py
- Evaluate results:
python Eval.py
The repository includes an example PDF file, Understanding_Climate_Change.pdf, to test and demonstrate the functionality of RAG_Type.
We welcome contributions! Follow these steps to contribute:
- Fork this repository.
- Create a feature branch:
git checkout -b feature-name
- Commit your changes and push them to your forked repository.
- Submit a pull request describing your changes.
This project is licensed under the MIT License.
For issues or suggestions, feel free to open a GitHub issue in this repository!