NeoRAG
A self-hosted RAG agent you fine-tune from a weak open-source model into a retrieval-grounded specialist.
100% free information layer · model-agnostic LLM slot · fully local retrieval
What is NeoRAG?
NeoRAG is an agentic Retrieval-Augmented Generation system built on three uncompromising principles:
| # | Principle | Meaning |
|---|---|---|
| 1 | Information gathering is always free | Web search, page scraping, embeddings, and the vector store need zero API keys and zero credits — no rate-limit death, no billing surprises. |
| 2 | The LLM slot is model-agnostic | Any model in the world fits: local HuggingFace checkpoints, Groq free tier, OpenRouter free models, Ollama, LM Studio, vLLM, or paid clouds. Switching models is one config change. |
| 3 | The weak model becomes a strong one | A fine-tuning loop teaches your small local model grounded, cited answering and the agent's JSON tool protocol — so it behaves like a disciplined RAG specialist, not a chatbot. |
NeoRAG answers questions from your local documents and the live web, always with numbered citations, always through one command-line interface.
How it works
┌─────────────────────────────────────────────────┐
data/corpus/* │ NEO RAG PIPELINE │
(pdf/md/docx/...) │ │
│ ingest │ ┌─────────┐ ┌──────────┐ ┌───────────┐ │
▼ │ │ chunker │──▶│ embedder │──▶│ ChromaDB │ │
┌──────────────┐ │ └─────────┘ │ (MiniLM) │ │ (local) │ │
│ load corpus │ │ └──────────┘ └─────┬─────┘ │
└──────────────┘ │ │ retrieve │
│ ┌──────────────────────────┐ ▼ │
web (free): │ │ DuckDuckGo + scraper │ ┌──────────┐ │
DuckDuckGo HTML search │ │ 7-day cache, freshness- │─▶│ Retriever│ │
SearxNG fallback │ │ aware (time-sensitive │ └────┬─────┘ │
──────────────────────▶│ │ queries bypass cache) │ │ │
│ └──────────────────────────┘ ▼ │
│ ┌───────────┐ │
│ │ LLM │ │
│ │ any model │ │
│ └─────┬─────┘ │
└──────────────────────────────────│─────────────┘
▼
┌──────────────────────────┐
│ FAST MODE 1 LLM call │
│ AGENT MODE ReAct loop │
│ → cited answer + sources│
└──────────────────────────┘
Installation
From PyPI (recommended):
pip install neorag
From source:
git clone https://github.com/naitik0409/NeoRAG.git
cd NeoRAG
pip install -e .
Optional extras:
pip install "neorag[train]" # LoRA fine-tuning: trl, bitsandbytes, sentence-transformers, faiss
pip install "neorag[dev]" # pytest + ruff
Requirements: Python 3.10+. No GPU needed to chat — CPU-only machines run the full fast mode. A GPU (local CUDA or free Colab T4) is only needed for the train step.
Quickstart (60 seconds)
The fastest path is the free Groq tier — one key, no config file needed:
# 1. Get a free key at https://console.groq.com (no card, no credits)
# 2. Make it visible:
setx GROQ_API_KEY "gsk_your_key" # Windows (new terminal after)
export GROQ_API_KEY="gsk_your_key" # macOS/Linux
# 3. Chat — that's it. Zero config.
neorag chat
Or put the key in a .env file in your working directory:
GROQ_API_KEY=gsk_your_key
Without any key, NeoRAG still works fully offline with a local model (Qwen/Qwen2.5-0.5B-Instruct by default — weak but free, and exactly what the fine-tuning loop upgrades):
neorag chat --backend local
Answer modes
| Mode | How it works | Best for | Start with |
|---|---|---|---|
| Fast (default) | Parallel local-docs + web retrieval, merged numbered context, one LLM call | everyday questions, speed | neorag chat |
| Agent | ReAct loop: the model reasons, calls search / web_search tools step by step, cites, then answers |
hard multi-hop questions | neorag chat --agent |
| Direct | Your local corpus only — web disabled | private knowledge bases | neorag chat --direct |
Toggle anytime inside chat with /mode, /web, /steps.
Your own free "Tavily"
NeoRAG's web module needs no API key — it is search + scraping, entirely yours:
- Search: DuckDuckGo HTML (with
liteendpoint + SearxNG fallbacks), redirect unwrapping - Scrape: concurrent page fetching, 7-day local cache, politeness delay, per-page text caps
- Freshness-aware: time-sensitive queries (prices, news, "today", "latest"...) bypass the cache automatically; general questions stay cached for speed — controlled by
web.freshness: auto | always | cached - Corpus building: research a topic once, own it forever
neorag research "transformer architecture explained" # search + scrape + ingest
neorag research "daily gold price india" --pages 5
neorag chat --direct # now answers from your corpus
Everything lands in data/corpus/web/<topic>/ and is embedded on the spot.
Fine-tuning loop: weak → powerful
The core promise: upgrade a small open model into a retrieval-grounded specialist with your own data — for free.
| Step | Command | What it does |
|---|---|---|
| 1. Generate data | neorag build-dataset |
Synthetic QA pairs + agent-trajectory examples (the model learns the exact JSON tool protocol it must follow at inference) from your corpus |
| 2. Train | neorag train |
LoRA/QLoRA SFT with prompt-token masking (chat-template aware). Local CUDA — or the bundled free Colab notebook on a T4 |
| 3. Merge | neorag merge |
Bake the adapter into a standalone model |
| 4. Deploy | point config at it | llm.model_id: checkpoints/neorag-sft-merged |
neorag build-dataset --per-chunk 2
neorag train # or: notebooks/colab_training.ipynb (free T4)
neorag merge
neorag evaluate --dataset data/finetune/sft.jsonl --limit 25 --direct
Evaluation metrics: token-F1, answer rate, citation precision, gave-up rate.
Any LLM, one config
| You want | llm.backend |
Settings |
|---|---|---|
| Local HuggingFace model (default, free) | local |
model_id: Qwen/Qwen2.5-0.5B-Instruct |
| Your fine-tuned model | local |
model_id: checkpoints/neorag-sft-merged |
Groq free tier (default when GROQ_API_KEY set) |
api |
base https://api.groq.com/openai/v1 — live models: openai/gpt-oss-120b, openai/gpt-oss-20b, qwen/qwen3.8-27b |
| OpenRouter free models | api |
base https://openrouter.ai/api/v1, model ...:free |
| Ollama (local, free) | api |
base http://localhost:11434/v1 |
| LM Studio / vLLM / any OpenAI-compatible server | api |
same pattern |
| Paid clouds (OpenAI, Gemini, ...) | api |
same pattern — optional, never required |
No config file at all? Set three env vars and go:
export NEORAG_LLM_BACKEND=api
export NEORAG_LLM_API_BASE=https://openrouter.ai/api/v1
export NEORAG_LLM_MODEL=meta-llama/llama-3.3-70b-instruct:free
Full key reference: docs/CONFIGURATION.md.
Commands
| Command | Purpose |
|---|---|
neorag chat [--agent] [--direct] [--steps] |
interactive terminal UI (fast mode by default) |
neorag ingest [--clear] |
chunk + embed data/corpus/ into the local vector store |
neorag research "<query>" [--pages N] [--no-ingest] |
free web search + scrape → saved + embedded |
neorag build-dataset [--per-chunk N] [--limit N] |
generate the SFT fine-tuning set |
neorag train / neorag merge |
LoRA fine-tune / bake the adapter |
neorag evaluate [--dataset ...] [--limit N] |
F1 / answer rate / citation precision |
neorag wipe |
clear the vector store |
Chat commands: /mode fast↔agent · /web toggle web tool · /steps show agent trace · /stats corpus + model info · /clear · /help · /quit
Supported document types: txt, md, pdf, docx, html, csv, json — drop files into data/corpus/ and run neorag ingest.
What's inside
neorag/
├── data/ loaders (8 formats), chunker, QA-dataset generator
├── embeddings/ MiniLM mean-pooling embedder (thread-safe, batched)
├── store/ ChromaDB persistent wrapper
├── retrieval/ dense retriever + optional cross-encoder reranker
├── web/ DDG/SearxNG search, scraper with cache + freshness, WebSearcher
├── agent/ ReAct loop, tools, prompts, fast/direct one-call paths
├── llm/ local HF backend + OpenAI-compatible backend (SDK + fallback)
├── training/ data formatting (prompt masking), LoRA/QLoRA trainer, merge
├── eval/ token-F1, answer rate, citation precision
├── ui/ rich terminal UI: banner, live spinner phases, panels
└── cli.py argparse command surface
Documentation
| Doc | Contents |
|---|---|
docs/USAGE.md |
every command, chat commands, env vars |
docs/CONFIGURATION.md |
every config key explained |
docs/ARCHITECTURE.md |
module map, data flow, design decisions |
docs/DEPLOYMENT.md |
production setup, service install, backups |
docs/SECURITY.md |
API key hygiene, data boundaries |
docs/TROUBLESHOOTING.md |
known issues and fixes |
docs/ROADMAP.md |
planned work |
Development
git clone https://github.com/naitik0409/NeoRAG.git
cd NeoRAG
pip install -e ".[dev]"
pytest tests -q # 36 tests
Issues and pull requests welcome: https://github.com/naitik0409/NeoRAG/issues
Author: Naitik · GitHub profile · Repository
Licensed under the MIT License — free to use, modify, and distribute.
Metadata
Release files for neorag 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| neorag-0.1.0.tar.gz | 48.5 kB | Without provenance | Details for neorag-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| neorag-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for neorag-0.1.0-py3-none-any.whl |
Total release size: 96.0 kB
Release files / neorag-0.1.0.tar.gz
| Download URL | neorag-0.1.0.tar.gz |
|---|---|
| Size | 48.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f4cabb58aeb880ab04adf629542859664278f816936d9f34e82bbabe641cc23e
|
|
BLAKE2b-256 checksum How to use checksums |
e60dbea2624a9804aa50ea08f63db4f6e50724861b6f2b35df0b2bf422df97f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.4
|
Release files / neorag-0.1.0-py3-none-any.whl
| Download URL | neorag-0.1.0-py3-none-any.whl |
|---|---|
| Size | 47.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fcead81f71b61ad1ccae6779079bef679ec44f3cc96bd9d448dc38fd2a6188f3
|
|
BLAKE2b-256 checksum How to use checksums |
74f1cffcc466980dd40cee6443636844e02999c3627dc28ed7a1b1699d00c8cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.4
|
Security for neorag 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.