forked from SciPhi-AI/R2R
-
Notifications
You must be signed in to change notification settings - Fork 0
R2R is a RAG (Retrieval-Augmented Generation) engine with a RESTful API and prod features. Including hybrid search, knowledge graphs, and more..
License
NoTypo/R2R
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
## Table of Contents 1. [Install](#install) 2. [R2R Quickstart](#r2r-quickstart) 3. [R2R Dashboard](#r2r-dashboard) 4. [Community and Support](#community-and-support) 5. [Contributing](#contributing) # Install > [!NOTE] > Windows users are advised to use Docker to run R2R. <details open> <summary><b>Installing with Pip</b> 🐍 </summary> ```bash pip install r2r # setup env export OPENAI_API_KEY=sk-... 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 ``` < 783F details> <summary><b>Installing with Docker</b> 🐳</summary> Note: The R2R client must still be installed, even when running with Docker. Download the Python client with `pip install r2r`. To run R2R using Docker: ```bash # Setting up the environment. The right side is where you should put the value of your variable. export OPENAI_API_KEY=sk-... 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 # Optional on first pull. Advised when fetching the main updates. docker pull emrgntcmplxty/r2r:main # Runs the image. If you set up the environment you don't need to modify anything. # Otherwise, add your values on the right side of the -e commands. # For Windows, remove the "\" from your command. docker run -d \ --name r2r \ -p 8000:8000 \ -e POSTGRES_USER=$POSTGRES_USER \ -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD \ -e POSTGRES_HOST=$POSTGRES_HOST \ -e POSTGRES_PORT=$POSTGRES_PORT \ -e POSTGRES_DBNAME=$POSTGRES_DBNAME \ -e OPENAI_API_KEY=$OPENAI_API_KEY \ emrgntcmplxty/r2r:main ``` **Important:** The Docker image of r2r operates in server and client mode, with the server being the Docker container and the client being your PC. This means you need to append `--client_server_mode` to all your queries. Additionally, your PC (acting as the client) needs to have Python, Pip, and the dependencies listed in the r2r folder of the repository. Therefore, you need to have the repository cloned on your computer and run `pip install r2r` in the root folder of the cloned repository. You have the option to run the client inside the terminal of the Docker container (to have everything in one place), but the use of `pip install r2r` and `--client_server_mode` is necessary. For local LLMs: ```bash docker run -d \ --name r2r \ --add-host=host.docker.internal:host-gateway \ -p 8000:8000 \ -e POSTGRES_USER=$POSTGRES_USER \ -e POSTGRES_PASSWORD=$POSTGRES_PASSWORD \ -e POSTGRES_HOST=$POSTGRES_HOST \ -e POSTGRES_PORT=$POSTGRES_PORT \ -e POSTGRES_DBNAME=$POSTGRES_DBNAME \ -e OLLAMA_API_BASE=http://host.docker.internal:11434 \ -e CONFIG_OPTION=local_ollama \ emrgntcmplxty/r2r:main ``` </details> # Updates Star R2R on GitHub by clicking "Star" in the upper right hand corner of the page to be instantly notified of new releases. # R2R Quickstart The following quickstart offers a step-by-step guide on running R2R locally as well as through the Python SDK. The guide ingests a list of provided provided documents and shows search, RAG, and advanced functionality. The script powering the quickstart can be found at `r2r/examples/quickstart.py`, and it can be configured and extended with sufficient developer familiarity.  <details open> <summary><b>Document Ingestion and Management</b></summary> 1. **Ingest Files**: ```bash python -m r2r.examples.quickstart ingest_files ``` 2. **View Document Info**: ```bash python -m r2r.examples.quickstart documents_overview ``` 3. **View User Overview**: ```bash python -m r2r.examples.quickstart users_overview ``` </details> <details open> <summary><b>Search and RAG Operations</b></summary> 1. **Search Documents**: ```bash python -m r2r.examples.quickstart search --query="Who was Aristotle?" ``` 2. **RAG Completion**: ```bash python -m r2r.examples.quickstart rag --query="What was Uber's profit in 2020?" ``` 3. **Streaming RAG**: ```bash python -m r2r.examples.quickstart rag --query="What was Lyft's profit in 2020?" --streaming=true ``` 4. **Hybrid Search RAG**: ```bash python -m r2r.examples.quickstart rag --query="Who is John Snow?" --do_hybrid_search ``` </details> For more detailed examples and advanced features, please refer to our [Quickstart Guide](https://r2r-docs.sciphi.ai/quickstart). # R2R Dashboard Interact with R2R using our [open-source React+Next.js dashboard](https://github.com/SciPhi-AI/R2R-Dashboard). Check out the [Dashboard Cookbook](https://r2r-docs.sciphi.ai/cookbooks/dashboard) to get started!
About
R2R is a RAG (Retrieval-Augmented Generation) engine with a RESTful API and prod features. Including hybrid search, knowledge graphs, and more..
Resources
License
Code of conduct
Security policy
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 73.8%
- Jupyter Notebook 25.6%
- Other 0.6%