Skip to main content

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 BaseRetriever for seamless use with LangChain chains

Installation

pip install rag_select

Quick Start

To set up an experiment with RAG-select, follow these steps:

  1. 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.
  2. 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),
    ]
    
  3. Run the Experiment

    • Instantiate the RAGExperiment and 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()
    
  4. Extending the Search Space

    • To experiment with ingestion or storage variants, include them as keys in search_space and provide corresponding implementations.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rag_select-0.1.3.tar.gz (39.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rag_select-0.1.3-py3-none-any.whl (76.0 kB view details)

Uploaded Python 3

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

Hashes for rag_select-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5608f183379e5bbd823c1c964121b5d2a051dbc3d0f5f493b82bd43f85b26b18
MD5 61b0056e1b7ed8cfdd26b75d4b6388fc
BLAKE2b-256 c38ec815d8e872af576cfce7ef696d03239a8bba9987b482dccc639feef64c8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rag_select-0.1.3.tar.gz:

Publisher: python-publish.yml on conclude-ai/rag-select

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for rag_select-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0616e43599e4778ce2e5e535c90089bb4f081c1766f1a4848d6bfa079e205b42
MD5 d969e7d4b356db0642c40d4282c3aad4
BLAKE2b-256 8759c4f2ed428209183b86089a9eb32f9bcc15ce127ff8e34434518a135564a2

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page