Skip to content

PavanBhat007/report-pdf-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📄 PDF RAG System

Upload PDFs and query them using an open-source LLM (Mistral via Ollama).


🧰 Requirements

Install:

  • Node.js (>= 18)
  • Python (>= 3.9)
  • pip

⚙️ 1. Install & Run Ollama (LLM)

Install

Mac

brew install ollama

Linux

curl -fsSL https://ollama.com/install.sh | sh

Windows


Start Ollama

Mac/Linux

ollama serve

Windows

  • Ollama usually starts automatically after install
  • If not, open Command Prompt / PowerShell:
ollama serve

Download model

ollama pull mistral

(Optional test)

ollama run mistral

🖥️ 2. Backend Setup (FastAPI)

cd backend
python -m venv .venv

Activate virtual environment

Mac/Linux

source .venv/bin/activate

Windows (CMD)

.venv\Scripts\activate

Windows (PowerShell)

.venv\Scripts\Activate.ps1

Install dependencies

pip install fastapi uvicorn chromadb pymupdf sentence-transformers requests

Run backend

uvicorn main:app --reload

Runs at:

http://localhost:8000

💻 3. Frontend Setup (React)

cd frontend
npm install
npm run dev

Runs at:

http://localhost:5173

▶️ Run Everything (order matters)

  1. Start Ollama
ollama serve
  1. Start backend
cd backend
uvicorn main:app --reload
  1. Start frontend
cd frontend
npm run dev

🧪 Usage

  1. Open frontend in browser

  2. Upload a PDF

  3. Ask questions like:

    • "What is the total amount?"
    • "Who is billed?"

⚠️ Common Issues

LLM not responding

ollama serve

First run is slow

  • Mistral downloads ~4–5GB (one-time)

PowerShell script blocked (Windows) Run:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Empty answers

  • PDF may not contain extractable text (scanned PDFs need OCR)

📌 Notes

  • Uses ChromaDB (local vector DB)
  • Uses sentence-transformers for embeddings
  • If answer not found → returns:
Not found in document

✅ Done

If all 3 services are running (Ollama → Backend → Frontend), the system should work end-to-end.

About

An application that allows you to analyse and query report using a RAG based system

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages