R2R

RAG & Memory 💻 Python ⚖️ MIT 🔴 No recent commits
8.0k stars

R2R is a production-ready AI retrieval augmented generation (RAG) engine that provides a developer-first API for building, scaling, and deploying RAG applications. It solves the complexity of integrating vector databases, LLMs, and document pipelines by offering a unified system with a RESTful API, SDKs, and a CLI. It is for developers who need to quickly build and deploy RAG-based applications with production-grade features.

✨ Key features

  • Production-ready RAG engine with RESTful API, Python/TypeScript SDKs, and CLI
  • Supports hybrid search (semantic + keyword) and advanced reranking
  • Built-in document ingestion pipeline with chunking and embedding
  • User and document management with role-based access control
  • Observability with logging, metrics, and tracing
  • Extensible via custom pipelines and integrations

🎯 Use cases

  • Build question-answering systems over private or public documents
  • Create semantic search applications with hybrid retrieval
  • Deploy scalable RAG APIs for chatbots or copilots
  • Manage and serve document collections with access control
  • Integrate RAG into existing applications via SDKs or REST

📦 Installation

🧰 Requirements: Requires Python 3.9+ or Node.js 18+, and a running PostgreSQL database with pgvector extension (or Docker for quick start). API keys for LLM providers (e.g., OpenAI) and embedding models may be needed.

Install the R2R server and client
pip install r2r
Or use Docker for a full setup
docker run -d --name r2r -p 8000:8000 r2r/r2r:latest

🚀 Usage

from r2r import R2RClient

client = R2RClient(base_url="http://localhost:8000")

# Ingest a document
client.ingest_files(["path/to/document.pdf"])

# Search
results = client.search(query="What is R2R?")
print(results)

⚠️ Good to know

The project is in active development and may have breaking changes; it requires a PostgreSQL database with pgvector and assumes you have API keys for LLM providers.

❓ FAQ

What are the system requirements for R2R?

R2R requires Python 3.9+ or Node.js 18+ and a PostgreSQL database with the pgvector extension. You can also use Docker for a quick setup.

How do I ingest documents into R2R?

You can use the REST API, Python/TypeScript SDKs, or CLI. For example, with the Python client, call client.ingest_files(["path/to/document.pdf"]).

Does R2R support hybrid search?

Yes, R2R supports hybrid search combining semantic and keyword search, along with advanced reranking.

Can I extend R2R with custom pipelines?

Yes, R2R is extensible via custom pipelines and integrations, allowing you to tailor the ingestion and retrieval process.

📊 Repository

Stars★ 7,989
Forks🍴 649
Open issues🐛 126
Last commit🕒 Nov 7, 2025
Created📅 Feb 2024
Language💻 Python
License⚖️ MIT

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.