Skip to content

A playground for exploring and comparing various Retrieval-Augmented Generation (RAG) implementations.

License

Notifications You must be signed in to change notification settings

kvpratama/rag-playground

Repository files navigation

RAG Playground

A collection of advanced Retrieval-Augmented Generation (RAG) implementations using LangGraph. This repository showcases different RAG architectures, each designed to handle various retrieval and generation scenarios.

Implementations

1. RAPTOR

Overview: Implements Recursive Abstractive Processing for Tree-Organized Retrieval, providing advanced document processing and hierarchical information retrieval.

Key Features:

  • Hierarchical document clustering
  • Multi-level summarization
  • Efficient retrieval from large document collections

RAPTOR paper

RAPTOR Workflow

2. Corrective RAG (CRAG)

Overview: An enhanced RAG system that incorporates web search capabilities to handle out-of-distribution queries and correct potential inaccuracies in retrieved information.

Key Features:

  • Web search fallback for unknown queries
  • Automatic correction of retrieved information
  • Dynamic query transformation

CRAG paper

CRAG Workflow

3. Self-RAG

Overview: A Self-Reflective RAG system that enhances traditional RAG with self-assessment capabilities. It evaluates the quality of retrieved documents and generated responses, enabling iterative improvements.

Key Features:

  • Self-assessment of document relevance
  • Iterative response refinement
  • Quality control for generated outputs

Self-RAG paper

Self-RAG Workflow

4. Agentic RAG

Overview: Combines LLM agents with RAG, enabling dynamic decision-making during the retrieval and generation process through an agent-based architecture.

Key Features:

  • Autonomous decision-making for retrieval
  • Dynamic tool usage
  • Flexible response generation

Agentic RAG

Agentic RAG Workflow

5. Adaptive RAG

Overview: Intelligently routes queries based on complexity, choosing between direct generation and a more sophisticated RAG approach.

Key Features:

  • Automatic query complexity assessment
  • Dynamic routing between generation strategies
  • Optimized performance for different query types

Adaptive RAG paper

Adaptive RAG Workflow

Streamlit Frontend

This project includes an intuitive Streamlit-based frontend to streamline experimentation and enhance usability. Check out our demo here. (Note: You may encounter errors if the API rate limit is exceeded.).

Installation

# Install uv if you haven't already
pip install uv

# Create a virtual environment
uv venv

# Install the package with development dependencies
uv sync --extra dev

# Activate the virtual environment
source .venv/bin/activate

# Run the Streamlit app
streamlit run app.py

Acknowledgments

This project is heavily influenced by excelent RAG tutorials from LangGraph

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A playground for exploring and comparing various Retrieval-Augmented Generation (RAG) implementations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published