A flexible RAG (Retrieval-Augmented Generation) experimentation framework
Project description
RAG-select
A framework for experimenting with and optimizing Retrieval-Augmented Generation (RAG) pipeline architectures.
Overview
This package provides a framework for testing different RAG pipeline configurations and measuring their performance. It supports pluggable components for document ingestion, chunking strategies, and retrieval methods.
Features
- Modular Architecture: Pluggable components across the ingestion and retrieval stack with sample wrappers over top open-source component offerings.
- Experiment Pipeline: Generate and test all combinations of component variants
- LangChain Integration: RAGArtifact extends
BaseRetrieverfor seamless use with LangChain chains
Installation
pip install rag_select
Quick Start
To set up an experiment with RAG-select, follow these steps:
-
Prepare Your Dataset and Documents
dataset: This should be your evaluation set (e.g., queries and ground-truths).documents: The corpus to be indexed and retrieved from.
-
Define Component Variants
- Specify different variants for each pipeline stage. Import and instantiate implementations as needed.
Example:
from rag_select.parameter_impls.chunking_impls import SlidingWindowChunking from rag_select.parameter_impls.embedding_impls import HuggingFaceEmbedding from rag_select.parameter_impls.retriever_impls import SimpleRetriever chunking_variants = [ SlidingWindowChunking(chunk_size=256, chunk_overlap=20), SlidingWindowChunking(chunk_size=512, chunk_overlap=50), ] embedding_variants = [ HuggingFaceEmbedding(model_name="sentence-transformers/all-MiniLM-L6-v2"), ] retriever_variants = [ SimpleRetriever(top_k=3), SimpleRetriever(top_k=5), ]
-
Run the Experiment
- Instantiate the
RAGExperimentand call.run()to evaluate all pipeline combinations. - Review, compare, or rank the results.
Example:
from rag_select.experiment.rag_experiment import RAGExperiment experiment = RAGExperiment( dataset=eval_dataset, documents=documents, search_space={ "chunking": chunking_variants, "embedding": embedding_variants, "retriever": retriever_variants, }, metrics=["precision@3", "precision@5", "recall@5", "mrr"], ) results = experiment.run() # Rank pipelines by a metric ranked = results.rank(by="precision@5") # Get the best pipeline config best = results.get_best_pipeline()
- Instantiate the
-
Extending the Search Space
- To experiment with ingestion or storage variants, include them as keys in
search_spaceand provide corresponding implementations.
- To experiment with ingestion or storage variants, include them as keys in
License
MIT
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 rag_select-0.1.3.tar.gz.
File metadata
- Download URL: rag_select-0.1.3.tar.gz
- Upload date:
- Size: 39.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5608f183379e5bbd823c1c964121b5d2a051dbc3d0f5f493b82bd43f85b26b18
|
|
| MD5 |
61b0056e1b7ed8cfdd26b75d4b6388fc
|
|
| BLAKE2b-256 |
c38ec815d8e872af576cfce7ef696d03239a8bba9987b482dccc639feef64c8d
|
Provenance
The following attestation bundles were made for rag_select-0.1.3.tar.gz:
Publisher:
python-publish.yml on conclude-ai/rag-select
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rag_select-0.1.3.tar.gz -
Subject digest:
5608f183379e5bbd823c1c964121b5d2a051dbc3d0f5f493b82bd43f85b26b18 - Sigstore transparency entry: 823426242
- Sigstore integration time:
-
Permalink:
conclude-ai/rag-select@65c87b71d62a8a881fbb7a0d9dc78c03f9cbe97d -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/conclude-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@65c87b71d62a8a881fbb7a0d9dc78c03f9cbe97d -
Trigger Event:
release
-
Statement type:
File details
Details for the file rag_select-0.1.3-py3-none-any.whl.
File metadata
- Download URL: rag_select-0.1.3-py3-none-any.whl
- Upload date:
- Size: 76.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0616e43599e4778ce2e5e535c90089bb4f081c1766f1a4848d6bfa079e205b42
|
|
| MD5 |
d969e7d4b356db0642c40d4282c3aad4
|
|
| BLAKE2b-256 |
8759c4f2ed428209183b86089a9eb32f9bcc15ce127ff8e34434518a135564a2
|
Provenance
The following attestation bundles were made for rag_select-0.1.3-py3-none-any.whl:
Publisher:
python-publish.yml on conclude-ai/rag-select
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rag_select-0.1.3-py3-none-any.whl -
Subject digest:
0616e43599e4778ce2e5e535c90089bb4f081c1766f1a4848d6bfa079e205b42 - Sigstore transparency entry: 823426303
- Sigstore integration time:
-
Permalink:
conclude-ai/rag-select@65c87b71d62a8a881fbb7a0d9dc78c03f9cbe97d -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/conclude-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@65c87b71d62a8a881fbb7a0d9dc78c03f9cbe97d -
Trigger Event:
release
-
Statement type: