A fully local AI chatbot that can ingest your PDFs, store knowledge in a vector database, and answer questions grounded in your documents — with no data leaving your machine.
Built for fast iteration, privacy, and real-world usage.
This project runs in two parts:
- Ollama runs directly on Windows and provides the local embedding and chat models.
- FastAPI runs in Docker and connects to Ollama through
host.docker.internal. - Qdrant stores the document vectors in your Qdrant Cloud cluster.
Make sure Docker Desktop is open and its engine says Running. You also need Ollama running on Windows. This project does not start an Ollama container.
Open Command Prompt or PowerShell and go to the project folder:
cd /d E:\RAG_LLMCheck that Ollama is available and that both required models are installed:
ollama listThe list should contain nomic-embed-text and llama3:instruct. Install a
missing model once with:
ollama pull nomic-embed-text
ollama pull llama3:instructIf Ollama is not running, start the Ollama application from the Windows Start menu. You can also check its local API in a browser at http://localhost:11434/api/tags.
Create the environment file only if it does not already exist:
copy .env.example .envOpen .env and set your Qdrant Cloud values and a private API key:
QDRANT_URL="https://your-cluster.region.cloud.qdrant.io:6333"
QDRANT_API_KEY="your-qdrant-manage-write-api-key"
QDRANT_COLLECTION="rag_collection"
API_KEY="choose-a-private-api-key-for-this-app"Use the exact cluster URL from Qdrant Cloud. The collection should use 768
dimensions, cosine distance, and the Simple Single embedding setup for
nomic-embed-text. Never commit the real .env file or its keys.
From E:\RAG_LLM, run:
docker compose up --buildThe first build downloads the Python image and installs the application dependencies, so it can take several minutes. Keep this terminal open. The API is ready when the container remains running without startup errors.
Open http://localhost:8000/docs in your browser.
-
In the Swagger page, click Authorize.
-
Enter the exact
API_KEYvalue from.envand click Authorize. -
Open
POST /ingest, click Try it out, choose a PDF, and click Execute. -
Open
POST /query, click Try it out, and send:{ "prompt": "What does the uploaded document say about pricing?" }
The PDF must be ingested before querying it. Ingestion creates embeddings with Ollama and stores them in the Qdrant collection.
After the image has been built, start Docker Desktop and Ollama, then run:
cd /d E:\RAG_LLM
You only need --build again after changing the Dockerfile, requirements, or
application dependencies.
Press Ctrl+C in the terminal running Compose. To remove the stopped container:
docker compose downQuit Ollama from the Windows system tray. Create or update the Windows user environment variable below, then start Ollama again:
OLLAMA_HOST=0.0.0.0:11434
The Compose file already tells the API container to use
http://host.docker.internal:11434. Restarting Ollama after changing the
environment variable is required.
| Feature | Benefit |
|---|---|
| Local LLM (Ollama) | No cloud charges, full privacy |
| Qdrant Vector DB | Fast semantic search |
| LangChain RAG Pipeline | Accurate answers grounded in docs |
| PDF ingestion | Build your own knowledge base |
| Chunking + embeddings | Better recall and context coverage |
| Dockerized deployment | Works anywhere with a single command |
| Authentication via API Key | Blocks unauthorized access |
┌──────────────┐
PDF ───► │ Ingestion API │─────────┐
└───────┬──────┘ │
│ ▼
Text Splitter Qdrant VectorDB
│ ▲
▼ │
Embedding Model ───────┘
│
▼
Question ─► RAG Pipeline ─► Local LLM (Ollama)
│
▼
Answer ✔
- 🧩 FastAPI
- 🧬 LangChain
- 🧠 Ollama (Llama3 / Mistral models)
- 🗄 Qdrant (cloud or local)
- 🐳 Docker & Docker Compose
git clone https://github.com/Rishy-09/RAG_LLM.git
cd RAG_LLMCopy and fill your values:
cp .env.example .envRequired keys:
QDRANT_URL=https://YOUR_CLUSTER.region.cloud.qdrant.io:6333
QDRANT_API_KEY=YOUR_KEY
QDRANT_COLLECTION=rag_collection
OLLAMA_HOST=http://localhost:11434
LLM_MODEL=llama3:instruct
TEXT_EMBEDDING_MODEL=nomic-embed-text
TEMP_FOLDER=./_temp
API_KEY=YOUR_FASTAPI_KEY
CHUNK_SIZE=1000
CHUNK_OVERLAP=150
TOP_K=5
Don’t commit your real
.envto GitHub..gitignoreprotects it.
docker compose up --buildWait until services are running.
| Method | Endpoint | Description |
|---|---|---|
| POST | /ingest |
Upload PDF → Embed into Qdrant |
| POST | /query |
Ask a question, get RAG answer |
| GET | /docs |
Swagger API UI |
Example request:
curl -X POST "http://localhost:8000/query" \
-H "x-api-key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt": "What does the PDF say about pricing?"}'
Response includes:
✔ Answer
✔ Source text chunks
✔ Confidence based on retrieval score
Install Ollama: https://ollama.ai
Pull a model:
ollama pull llama3:instructSwitch models easily via .env.
- API requires
x-api-key - CORS restricted (only allowed origins)
- Secrets never stored in Git
- Safe for local confidential documents
- Web UI for chatting with sources
- Streaming responses
- Multi-user document buckets
- Citations with timestamps + PDF page mapping
Made by Naman (Rishy-09) Open-source forever.



