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.
I set up a docker container with postgres and neo4j already configured. You can run the container with
sudo docker compose up --buildTo 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-shellYou can install the dependencies with
poetry install -E allYou 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 serveYou are now ready to go
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
-
Ingest Files: Here we are training the model on this files
python -m r2r.examples.quickstart ingest_files
-
View Document Info: List the documents ingested
python -m r2r.examples.quickstart documents_overview
-
View User Overview:
python -m r2r.examples.quickstart users_overview
Search and RAG Operations
-
Search Documents: Get the documents relevant to the query
python -m r2r.examples.quickstart search --query="Who was Aristotle?" -
RAG Completion: Get completition (an answer) to the query
python -m r2r.examples.quickstart rag --query="What was Uber's profit in 2020?" -
Streaming RAG:
python -m r2r.examples.quickstart rag --query="What was Lyft's profit in 2020?" --stream=true -
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.
Interact with R2R using our open-source React+Next.js dashboard. Check out the Dashboard Cookbook to get started!
