Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Document Q&A Assistant (RAG System)

A portfolio-ready Retrieval-Augmented Generation project using LangChain, FAISS, OpenAI API, and Streamlit.

Project Description

Document Q&A Assistant (RAG System) | LangChain, FAISS Vector DB, OpenAI API, Streamlit
• Built a Retrieval-Augmented Generation tool that ingests PDFs and answers natural language queries.
• Implemented FAISS vector indexing for semantic search across document chunks.
• Generated answers grounded strictly in uploaded document context with source previews to reduce hallucination.

Features

  • Upload PDF, TXT, or Markdown documents
  • Extract text from PDFs
  • Split documents into semantic chunks
  • Create FAISS vector database
  • Ask natural language questions
  • Answer strictly from document context
  • Display source file, page number, and preview
  • Generate grounded document summary
  • Smooth premium Streamlit UI with custom CSS animations
  • Reset vector database and uploaded files
  • Chat history panel

Tech Stack

  • Python
  • Streamlit
  • LangChain
  • FAISS Vector DB
  • OpenAI API
  • pypdf
  • dotenv

Folder Structure

Document_QA_RAG_Assistant
├── app
│   ├── config.py
│   ├── document_loader.py
│   └── rag_engine.py
├── sample_docs
│   └── sample_company_policy.txt
├── main.py
├── requirements.txt
├── .env.example
└── README.md

Setup on Windows

1. Open project folder

cd "D:\Document_QA_RAG_Assistant"

2. Create virtual environment

python -m venv venv

3. Activate virtual environment

.\venv\Scripts\Activate.ps1

If PowerShell blocks activation:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\venv\Scripts\Activate.ps1

4. Install dependencies

python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements.txt

5. Add OpenAI API key

Copy env file:

copy .env.example .env
notepad .env

Add your key:

OPENAI_API_KEY=your_real_key_here

6. Run Streamlit app

streamlit run main.py

Open:

http://localhost:8501

How to Use

  1. Upload PDF/TXT/MD files.
  2. Click Build FAISS Vector Index.
  3. Ask a question.
  4. The assistant retrieves relevant chunks.
  5. Answer is generated strictly from uploaded document context.
  6. Source previews are shown below the answer.

Sample Questions

What is the main purpose of this document?
Summarize the document in 5 bullet points.
What are the key policies mentioned?
What limitations are discussed?

Future Improvements

  • Add user login
  • Add multi-document workspace support
  • Add chat export to PDF
  • Add local embeddings support
  • Add reranking model
  • Add citation highlighting
  • Add Docker deployment
  • Add vector DB persistence per user
  • Add support for DOCX, CSV, and web URLs

About

AI-powered Document Q&A Assistant using LangChain, FAISS, OpenAI API, and Streamlit for PDF-based RAG and grounded answers.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages