Skip to content

seshukalyanam/PDF-RAG-Assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF RAG Assistant

A clean Python project for building a Retrieval-Augmented Generation assistant over local PDF files.

This project lets you:

  • Load one or more PDF files from a local folder
  • Split the extracted text into searchable chunks
  • Create an OpenAI embedding index using FAISS
  • Ask questions against the indexed PDF content
  • Optionally rerank retrieved chunks with Cohere
  • Run a simple evaluation against your own test questions

Project Structure

pdf-rag-assistant/
├── data/                         # Place your PDF files here
├── vector_store/                 # FAISS index is saved here
├── src/
│   └── rag_pdf_assistant/
│       ├── __init__.py
│       ├── chat.py
│       ├── config.py
│       ├── evaluation.py
│       ├── indexer.py
│       ├── pdf_loader.py
│       └── prompts.py
├── main.py
├── requirements.txt
├── .env.example
└── .gitignore

Setup

1. Create a virtual environment

python -m venv .venv

Windows:

.venv\Scripts\activate

Mac/Linux:

source .venv/bin/activate

2. Install dependencies

pip install -r requirements.txt

3. Add environment variables

Create a .env file in the project root:

OPENAI_API_KEY=your_openai_api_key_here
COHERE_API_KEY=optional_cohere_api_key_here

Cohere is optional. If you do not add a Cohere key, the project will use normal FAISS similarity retrieval.

4. Add PDF files

Place your PDFs inside the data/ folder.

5. Build the vector index

python main.py build

6. Ask a question

python main.py ask "What is this document about?"

7. Start interactive chat

python main.py chat

8. Run sample evaluation

python main.py evaluate

Notes for GitHub

Do not upload your .env file, API keys, or private PDFs. The .gitignore file already excludes common sensitive/local files.

About

End-to-end LLM-based PDF RAG assistant with intelligent chunking, embeddings, FAISS vector search, and context engineering for accurate document question-answering.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages