Skip to content

Latest commit

Β 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

VectorDocs Logo

VectorDocs πŸ§ πŸ€–

Hybrid Retrieval-Augmented Document Intelligence Assistant


πŸš€ Overview

VectorDocs is a session-aware Retrieval-Augmented Generation (RAG) assistant that allows users to upload documents (PDF / TXT / JSON) and interact with them conversationally.

Unlike basic vector-only RAG systems, VectorDocs uses a hybrid retrieval pipeline combining semantic embeddings, keyword search, and cross-encoder reranking to deliver accurate, grounded answers with reduced hallucinations.


🧠 Why VectorDocs?

Traditional RAG systems often:

  • Miss exact keywords (IDs, logs, error codes)
  • Retrieve loosely related chunks
  • Hallucinate when context is weak

VectorDocs solves this by design.

πŸ”¬ Hybrid Retrieval Pipeline

FAISS (Semantic Recall)
      +
BM25 (Keyword Precision)
      ↓
Cross-Encoder Reranking
      ↓
Hallucination-Guarded Answering

✨ Features

Feature Description
πŸ“‚ Session Isolation Independent document index per chat
πŸ” Hybrid Retrieval FAISS + BM25
🧠 Reranking ms-marco-MiniLM-L-6-v2
πŸ›‘ Hallucination Guard Context-validated answers
πŸ—‚ File Support PDF, TXT, JSON
πŸ’Ύ Local Cache Persistent FAISS + BM25
πŸ’¬ Chat Sessions Switch chats without losing progress
🧩 Modular Codebase Easy to extend

πŸ— Architecture

User
 ↓
Streamlit UI
 ↓
Loader & Chunker
 ↓
Hybrid Retrieval Engine
  β”œβ”€ FAISS
  β”œβ”€ BM25
  └─ Cross-Encoder
 ↓
LLM (Answer + Validation)

πŸ“ Project Structure

VectorDocs/
│── app/
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ components/
β”‚   └── utility/
│── loader/
│── vector_store/
│── embeddings/
│── assets/
β”‚   β”œβ”€β”€ logo.png
β”‚   └── screenshots/
│── data/
│── LICENSE
│── README.md
│── requirements.txt

βš™οΈ Installation & Run (Local)

1️⃣ Create Virtual Environment

python -m venv .venv
source .venv/bin/activate     # Linux / Mac
.venv\Scripts\activate        # Windows

2️⃣ Install Dependencies

pip install -r requirements.txt

3️⃣ Run the App

streamlit run app/main.py

Open πŸ‘‰ http://localhost:8501


🐳 Run with Docker Image

Pull the published image directly from Docker Hub:

docker pull mahar628/vectordocs:latest

Run the application:

docker run --rm -p 8501:8501 mahar628/vectordocs:latest

Open πŸ‘‰ http://localhost:8501


πŸ”‘ Setting OPENAI_API_KEY (Streamlit UI)

VectorDocs allows you to set the OpenAI API key directly from the Streamlit web interface.

🧭 Steps

  1. Launch the app

  2. In the sidebar, find β€œOpenAI API Key”

  3. Paste your key:

    sk-********************************
    
  4. Press Enter / Save

πŸ” Security Notes

  • Stored only in Streamlit session state
  • Isolated per browser session
  • Never written to disk or source code
  • Cleared on app restart

πŸ“€ Uploading Documents

Supported formats:

  • πŸ“„ PDF
  • πŸ“œ TXT
  • 🧾 JSON

Workflow

  1. Upload files from the sidebar

  2. Files are:

    • Parsed
    • Chunked
    • Indexed using FAISS + BM25
  3. Uploads can be incremental β€” indexes update automatically


πŸ’¬ Chat-Based Sessions

Each chat session maintains:

  • Independent document uploads
  • Separate FAISS + BM25 indexes
  • Its own conversation history

You can switch between chats without losing progress.


πŸ–Ό UI Preview


πŸ“ Featured Article

I wrote about the motivation behind VectorDocs, the problems I encountered with existing Chat-with-PDF applications, and why I decided to build my own document Q&A system.

πŸ‘‰ Why I Stopped Trusting Chat-with-PDF Apps and Built My Own

Explore the journey behind VectorDocs β€” from the limitations of existing PDF chat tools to building a more transparent and controllable document intelligence application.


πŸ“œ License

Licensed under the MIT License. See the LICENSE file for details.


⭐ Star the repository if you find this project useful!

About

RAG-powered document assistant to chat with your own PDFs, TXT, and JSON files using hybrid retrieval, reranking, and hallucination-safe answers. πŸ“šπŸ€–

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages