Skip to content

About

AI-powered PDF Question Answering Assistant using RAG, FAISS, LangChain, and Streamlit.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

8 Commits

Folders and files

Repository files navigation

πŸ€– AI PDF Question Answering Assistant

An AI-powered Retrieval-Augmented Generation (RAG) application that allows users to upload PDF documents and ask intelligent questions about their content. The system retrieves relevant information from uploaded documents and generates accurate contextual responses using Large Language Models (LLMs).

Python LangChain FAISS Streamlit OpenRouter RAG


πŸ“Œ Project Overview

The AI PDF Question Answering Assistant is a Generative AI application built using Retrieval-Augmented Generation (RAG).

Users can upload PDF documents and ask questions in natural language. The application extracts document content, creates embeddings, stores them in a FAISS vector database, retrieves the most relevant information, and generates context-aware answers using Large Language Models.

This project demonstrates practical implementation of:

  • Retrieval-Augmented Generation (RAG)
  • Semantic Search
  • Vector Databases
  • Embeddings
  • Large Language Models (LLMs)
  • Natural Language Processing (NLP)

πŸš€ Features

βœ… Upload PDF Documents

βœ… Extract Text from PDFs

βœ… Intelligent Question Answering

βœ… Semantic Search using Embeddings

βœ… FAISS Vector Database Integration

βœ… Context-Aware AI Responses

βœ… Streamlit Web Interface

βœ… Fast Document Retrieval


πŸ—οΈ System Architecture

User Uploads PDF
        ↓
Text Extraction
        ↓
Text Chunking
        ↓
Embedding Generation
        ↓
FAISS Vector Database
        ↓
Semantic Retrieval
        ↓
LLM Processing
        ↓
Answer Generation
        ↓
Response Displayed to User

πŸ› οΈ Tech Stack

Programming Language

  • Python

Frameworks & Libraries

  • Streamlit
  • LangChain
  • FAISS
  • Sentence Transformers
  • PyPDF2

AI Technologies

  • Retrieval-Augmented Generation (RAG)
  • Embeddings
  • Semantic Search
  • Large Language Models (LLMs)

API

  • OpenRouter API

πŸ’‘ Key Highlights

  • Implemented Retrieval-Augmented Generation (RAG) pipeline
  • Used FAISS for semantic vector search
  • Integrated LLM responses using OpenRouter API
  • Developed interactive UI using Streamlit
  • Enabled document-based question answering
  • Improved information retrieval efficiency
  • Reduced manual document searching effort

🧠 Skills Demonstrated

  • Python Programming
  • Machine Learning
  • Generative AI
  • Retrieval-Augmented Generation (RAG)
  • LangChain
  • FAISS
  • Vector Databases
  • Natural Language Processing (NLP)
  • Prompt Engineering
  • Semantic Search
  • Streamlit Development
  • API Integration

πŸ“· Demo Screenshots

🏠 Home Page

Home Page

πŸ“„ PDF Upload

PDF Upload

❓ User Question

Question

πŸ€– Generated Response

Answer


βš™οΈ Working Process

Step 1: Upload PDF

The user uploads a PDF document through the Streamlit interface.

Step 2: Text Extraction

Text content is extracted from the uploaded PDF.

Step 3: Chunking

Large text is divided into smaller chunks for efficient processing.

Step 4: Embedding Generation

Embeddings are generated using Sentence Transformers.

Step 5: Vector Storage

Generated embeddings are stored in a FAISS vector database.

Step 6: User Query

The user asks a question related to the uploaded document.

Step 7: Semantic Search

FAISS retrieves the most relevant document chunks.

Step 8: LLM Response Generation

Relevant chunks are passed to the LLM through OpenRouter API.

Step 9: Answer Display

The generated answer is displayed in the Streamlit interface.


πŸ“‚ Project Structure

AI-PDF-QA-Assistant/
β”‚
β”œβ”€β”€ app.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
β”œβ”€β”€ screenshots/
β”‚   β”œβ”€β”€ home-page.png
β”‚   β”œβ”€β”€ pdf-upload.png
β”‚   β”œβ”€β”€ user-question.png
β”‚   └── generated-answer.png
β”‚
β”œβ”€β”€ vector_store/
└── data/

πŸ”§ Installation

Clone Repository

git clone https://github.com/preethi-beri/AI-PDF-QA-Assistant.git

Move to Project Directory

cd AI-PDF-QA-Assistant

Install Dependencies

pip install -r requirements.txt

Run Application

streamlit run app.py

πŸ“‹ Requirements

Python 3.9+
Streamlit
LangChain
FAISS
Sentence Transformers
PyPDF2
OpenRouter API Key

🎯 Use Cases

  • Research Paper Analysis
  • Academic Document Search
  • Resume Analysis
  • Business Report Analysis
  • Legal Document Search
  • Knowledge Management Systems
  • Educational Assistance

πŸ“ˆ Future Enhancements

  • Multi-PDF Question Answering
  • Chat History Support
  • Voice-Based Queries
  • OCR for Scanned PDFs
  • Cloud Deployment
  • User Authentication
  • Citation Generation
  • Multiple File Format Support

πŸ† Learning Outcomes

Through this project, I gained practical experience in:

  • Generative AI Development
  • Retrieval-Augmented Generation (RAG)
  • Vector Databases (FAISS)
  • LangChain Framework
  • LLM Integration
  • Streamlit Application Development
  • Semantic Search Systems
  • End-to-End AI Project Development

πŸ‘©β€πŸ’» Author

Preethi Beri

B.Tech Computer Science & Data Science Student

AI/ML Enthusiast | Data Science Learner | Automation Testing Enthusiast

πŸ”— LinkedIn: https://www.linkedin.com/in/preethi-beri

πŸ”— GitHub: https://github.com/preethi-beri


⭐ If you found this project useful, consider giving it a star.

About

AI-powered PDF Question Answering Assistant using RAG, FAISS, LangChain, and Streamlit.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages