Requirements

Database Providers

  • • Postgres (relational)
  • • pgvector (vector)
  • • Neo4j (graph, optional)

Note, R2R Docker can optionally manage all these dependencies

LLM Providers

Local RAG

  • • Ollama

Cloud RAG

  • • OpenAI API key
  • • Other providers (e.g. Anthropic, ..)

Install with pip

The recommended way to get started with R2R is by using our CLI.

pip install r2r

Start R2R

Note, cloud providers are optional as R2R can be ran entirely locally.

# Set cloud LLM settings
# export OPENAI_API_KEY=sk-...
r2r --config-name=default serve --docker
# start Ollama in separate window, e.g. `ollama serve`
r2r --config-name=local_ollama serve --docker

Other local rag configs include local_neo4j_kg and local_ollama_rerank.

r2r --config-path=/abs/path/to/my_r2r.json serve

Ollama and Neo4j calling be bundled into the deployed Docker by passing the flags --docker-ext-ollama and --docker-ext-neo4j
The above command will automatically pull the necessary Docker images and start all the required containers, including the R2R API, dashboard, and a Postgres+pgvector database. When you are ready to stop the system, you may do so with r2r docker-down.

Env. Setup

R2R can be ran entirely from an local device, or can be connected with powerful cloud providers.

Alternative Installation Methods

Python Development Mode

For those looking to develop R2R locally:

  1. Install Poetry: Follow instructions on the official Poetry website.

  2. Clone and install dependencies:

    git clone [email protected]:SciPhi-AI/R2R.git
    cd R2R
    poetry install -E all
    
  3. Setup environment:

Follow the steps listed in Env. Setup above. Additionally, you may introduce a local .env file to make development easier, and you may customize your local r2r.json to suit your specific needs.

cp .env.example .env
# Edit .env with your environment variables
# Modify r2r.json as needed
  1. Run methods individually as needed for development.
# e.g. Run the server
poetry run r2r serve

# separate window
poetry run r2r ingest-sample-file

# OR run the R2R app directly for faster iteration & error detection
poetry run r2r ingest-sample-file --client-mode=False

Manual Docker Setup

If you prefer more control over the Docker setup or want to contribute to R2R development, you can manually set up the Docker environment:

  1. Clone the R2R repository:

    git clone https://github.com/SciPhi-AI/R2R.git
    cd R2R
    
  2. Install the R2R CLI and Python client:

    pip install .
    
  3. Choose your configuration:

Run with docker compose directly:

docker-compose up -d

Next Steps

After installation:

  1. Follow the R2R Quickstart guide
  2. Explore the more detailed R2R Walkthrough
  3. Join our Discord community for support and discussions

For more information on configuring and customizing R2R, check out our guides on configuration and customization.