A simple and clean AI-powered PDF Question Answering Agent built as part of the 5-Day AI Agents Intensive Course with Google & Kaggle (2025) where users upload a PDF and ask questions. This repository is a minimal, demonstrable project that satisfies the Kaggle/Google Capstone submission requirements.
- Home Page:
- Results Page:
- Architecture:
-
Upload a PDF
-
Ask questions about its contents
-
Receive contextual answers with source references
-
(Optional) Run in mock embedding mode to avoid API costs / quota usage
🔹Upload any PDF (up to ~10MB)
🔹Background processing of chunks
🔹Mock Embeddings Mode → works even without OpenAI API key
🔹Ask natural language questions about the document
🔹Source pages + similarity scores
🔹Beautiful and responsive React UI
🔹Node.js backend with in-memory vector search
-
React (Vite)
-
Custom UI (no CSS frameworks needed)
-
Fetch API for server communication
-
Node.js + Express
-
PDF parsing (pdf-parse)
-
In-memory vector store
-
OpenAI-compatible structure (mock or real)
-
Multer for file upload
ask-your-pdf
├── client/ # React frontend
├── server/ # Node.js backend
│ ├── embeddings.js
│ ├── index.js
│ └── uploads/
├── README.md # This file
└── ...Clone the repository:
git clone https://github.com/yourusername/ask-your-pdf.git
cd ask-your-pdfcd server
npm installCreate a .env file:
OPENAI_API_KEY=npm run devcd ../client
npm install
npm run dev-
Upload PDF
The server extracts text, splits it into chunks, and (in real mode) generates embeddings.
-
Ask a Question
The question is embedded and compared with stored chunk vectors.
-
Relevant chunks are fed into the model
In mock mode → uses local pseudo-embeddings
In real mode → uses OpenAI embeddings + Chat Completions
-
Final answer is displayed with source references.
This project supports a full offline mode where:
-
No API calls are made
-
No cost is incurred
-
Embeddings are simulated using deterministic vectors
Built by Kamran (mohdkamrankhan) Capstone for Google x Kaggle — 5-Day AI Agents Intensive (2025)
This project is open-source and available under the [MIT License]
📧 Contact / Feedback
If you find any bugs or want to suggest improvements, feel free to open an issue or create a pull request. You can reach me at: [mohdkamrankhan.dev@gmail.com]
💡 If you like my work, please ⭐ my repos. Your support inspires me to build more projects! 🚀
👨🏻💻 From mohdkamran-khan