Skip to content

San7o/R2R-fork

 
 

Repository files navigation

Docs Discord Github Stars Commits-per-week License: MIT

R2R Answer Engine

The ultimate open source RAG answer engine

About

This is my configuration for R2R, which lets you use AI to retrieve information from documents. I create the necessary docker containers to run the application and set up local ollama LLM with tinyllama.

For a more complete view of R2R, check out the full documentation.

Run

I set up a docker container with postgres and neo4j already configured. You can run the container with

sudo docker compose up --build

To run the application, make sure you have all the python dependencies installed You need poerty and python to run the application, on nixos shell.nix can be used to create your dev environment:

nix-shell

You can install the dependencies with

poetry install -E all

You then have to export all the variables in .env. Note that if you want to change a variable, you have to change also docker-compose.yaml.

To use a local model, you need Ollama and a model downloaded. You can start ollama with:

sudo ollama serve

You are now ready to go

Usage

All the following command must be prepended with porety run or you can run poerty shell once and run the commands in the shell.

!!!

If you are using ollama, you need to add --config_name=local_ollama after each command and --rag_generation_config='{"model":"ollama/tinyllama"}' after each rag command, with the model you want to use.

The configs are stored in r2r/examples/configs/. Some sample data is inside r2r/examples/data/.

Document Ingestion and Management
  1. Ingest Files: Here we are training the model on this files

    python -m r2r.examples.quickstart ingest_files
  2. View Document Info: List the documents ingested

    python -m r2r.examples.quickstart documents_overview
  3. View User Overview:

    python -m r2r.examples.quickstart users_overview
Search and RAG Operations
  1. Search Documents: Get the documents relevant to the query

    python -m r2r.examples.quickstart search --query="Who was Aristotle?"
  2. RAG Completion: Get completition (an answer) to the query

    python -m r2r.examples.quickstart rag --query="What was Uber's profit in 2020?"
  3. Streaming RAG:

    python -m r2r.examples.quickstart rag --query="What was Lyft's profit in 2020?" --stream=true
  4. Hybrid Search RAG:

    python -m r2r.examples.quickstart rag --query="Who is John Snow?" --do_hybrid_search

For more detailed examples and advanced features, please refer to our Quickstart Guide.

R2R Dashboard

Interact with R2R using our open-source React+Next.js dashboard. Check out the Dashboard Cookbook to get started!

About

R2R is a prod-ready RAG (Retrieval-Augmented Generation) engine with a RESTful API. R2R includes hybrid search, knowledge graphs, and more.

Resources

License

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 99.0%
  • Other 1.0%