This guide will help you get started with R2R quickly and efficiently.

Environment Variables

Vector Database

R2R uses Postgres with pgvector as the default vector database implementation. The following environment variabls are necessary to facilitate communication with the database.

Be sure to install the pgvector extension for your Postgres database.

export POSTGRES_USER=$YOUR_POSTGRES_USER
export POSTGRES_PASSWORD=$YOUR_POSTGRES_PASSWORD
export POSTGRES_HOST=$YOUR_POSTGRES_HOST
export POSTGRES_PORT=$YOUR_POSTGRES_PORT
export POSTGRES_DBNAME=$YOUR_POSTGRES_DBNAME
export POSTGRES_VECS_COLLECTION=demo_vecs

POSTGRES_VECS_COLLECTION corresponds to the collection within your Postgres database where the tables relevant to R2R reside. If the specified collection does not exist then it will be created by R2R during initialization.

Language Model Providers

Language model providers are not necessary when running with a local setup, as described in this cookbook. However, most of the docs assume default to hosted provider settings which require an OpenAI API key to be ran successfully.

OpenAI (default hosted provider)

export OPENAI_API_KEY=sk-...

Other LLM providers are supported:

export ANTHROPIC_API_KEY=...
export VERTEX_API_KEY=...
# Add other provider keys as needed

Installation

pip install r2r

Full Installation (Developers)

For developers looking to extend R2R:

  1. Install Poetry: Visit the official Poetry website for installation instructions.

  2. Clone and Install Dependencies:

    git clone [email protected]:SciPhi-AI/r2r.git
    cd r2r
    poetry install -E all
    
  3. Config Setup: Create .env and config.json files:

    cp .env.example .env
    vim .env  # Edit with your environment variables
    vim config.json  # Modify as needed
    
  4. Configure Environment Variables: At minimum, set up your OpenAI API key and PostgreSQL credentials in the .env file.

For detailed configuration instructions, refer to our Configuration Guide. When using poetry, you will need to append poetry run to every command in the documentation, or execute the commands after executing poetry shell.

Database Setup Help (Optional)

R2R uses PostgreSQL with pgvector for efficient relational data and vector storage. You can:

Configure your environment variables as shown in the Environment Setup section.

Next Steps

After installation:

  1. Follow the R2R Quickstart guide
  2. Explore specific features through our cookbooks
  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.