Repository navigation
Getting Started
This page takes you from a fresh clone to a working /query call. Short version: README.
- Python 3.12 (the version this was tested on; others are untested).
- A few GB of free disk space: PyTorch, plus three Hugging Face models downloaded on first start (
all-mpnet-base-v2,cross-encoder/ms-marco-MiniLM-L-6-v2,cross-encoder/nli-MiniLM2-L6-H768). - Internet access on first start.
- An API key for at least one LLM provider.
git clone https://github.com/PantheraNestah/nutripepper-rag.git
cd nutripepper-rag
python3.12 -m venv .venv && source .venv/bin/activate
requirements.txt pins NVIDIA CUDA and Triton packages (nvidia-*, cuda-*, triton). They do not install on a machine without a GPU and take several GB. Install CPU PyTorch first, then everything else except those lines:
pip install torch==2.12.0 --index-url https://download.pytorch.org/whl/cpu
grep -vE '^(nvidia-|cuda-|triton)' requirements.txt | grep -v '^torch==' > /tmp/requirements.nogpu.txt
pip install -r /tmp/requirements.nogpu.txt
pip check # should report no broken requirements
pip install -r requirements.txt is the intended path. It has not been tested on a GPU machine.
- It also contains packages the code does not use (for example
google-generativeai, Jupyter andpipreqs). They are harmless but add size. -
pytestis not listed. Install it to run the tests (Testing).
cp .env.example .env
Set the API key for each provider your tiers use. Only providers actually used by a tier need a key; a missing key only fails when that tier is first called.
Anthropic only (default). Set ANTHROPIC_API_KEY. Nothing else is needed.
DeepSeek only. Set DEEPSEEK_API_KEY and add:
LLM_MODEL_COMPLEX=deepseek:deepseek-flash:high
LLM_MODEL_MEDIUM=deepseek:deepseek-flash:low
LLM_MODEL_EASY=deepseek:deepseek-flash:low
Mixed. Set both keys and override only the tiers you want to move. Tiers with no line stay on Anthropic. Full reference: Configuration.
The vector store (app/chroma_storage/) is gitignored, so a fresh clone does not have it and the first retrieval fails with No ChromaDB collections found. The repository does include the extracted text (data/knowledge_base/nutrition_knowledge_base.json, 810 chunks), so you can build the store without the PDFs. From anywhere:
python data/scripts/build_vector_store.py
It embeds the chunks with all-mpnet-base-v2 (downloaded on first use; about 20 minutes on a CPU-only machine, measured at 22) and creates the collection nutrition_kb in app/chroma_storage/. Chunks are matched by ID and unchanged ones are skipped, so re-running is safe and quick (about half a minute when nothing changed); add --reset to delete the collection first. Options: --kb and --output to use other paths, --batch-size to tune memory. The ingestion step and how to add documents are in Knowledge Base.
uvicorn app.main:app --host 127.0.0.1 --port 8000
./run.sh does the same with --host 0.0.0.0 --reload. That listens on every network interface, and the API has no authentication, so use it only on a trusted network. --reload is for development.
- The SQLite tables are created if they do not exist.
- Models and indexes are preloaded in a worker thread: the vector store, the BM25 index, the embedding model, the re-ranker and the verification model. On a CPU this takes about 50 s including imports. You will see
[Warmup] retriever ready in ...and[Warmup] verifier ready in ...in the log. - The server starts accepting requests.
Set PRELOAD_MODELS=false to skip step 2. Startup is then quick, but the first request pays the loading cost (minutes on a CPU).
- Open http://127.0.0.1:8000/docs for the interactive API docs.
- Send a question:
curl -s -X POST http://127.0.0.1:8000/query \
-H 'Content-Type: application/json' \
-d '{"user_query": "What are good sources of iron for a toddler?"}'
Every response carries an X-Process-Time header. In the server log you should see the retrieval stages, a line like [LLM] tier=medium -> anthropic:claude-haiku-5-5:medium, and, some seconds later, [Logger] Verification complete.
If something fails, see Operations and Troubleshooting.
Documentation last verified against the code on 2026-11-05. Evaluation figures are historical, see Evaluation. Educational tool, not medical advice.
Use it
How it works
- Architecture
- Retrieval Pipeline
- LLM Layer
- Prompts and Lessons
- Grounding Verification
- Knowledge Base
- Data and Logging
Quality
Develop