AI-powered assistant that answers natural language questions from uploaded PDFs using semantic retrieval, and LLM-based re-ranking. Delivers accurate, explainable responses with relevance scores and direct PDF highlighting for traceability.








Feature | Description |
---|---|
π PDF Upload | Upload and parse PDF with page-level metadata |
π Semantic Search | Embed + retrieve most relevant chunks using similarity scoring |
π§ Re-Ranking | Use LLM to sort top chunks before answering |
π¬ Chat Support | Ask questions via text or voice |
π Similarity Scores | View how relevant each chunk is to your query |
π¦ PDF Highlighting | See exactly which paragraph the answer came from |
Layer | Tools |
---|---|
Frontend | React.js, TailwindCSS, React-PDF, Web Speech API |
Backend (Node.js) | Node.js, Express.js, OAuth, JWT |
Backend (AI-Engine) | Python, FastAPI , PyMuPDF |
LLM | Ollama |
Embeddings | all-MiniLM-L6-v2 |
Vector DB | ChromaDB |
A clear separation of responsibilities ensures maintainability and scalability. The project is divided into two major flows:
Step | Description |
---|---|
1οΈβ£ | PDF Upload: Admin uploads PDF files via the dashboard. |
2οΈβ£ | PDF Parsing: The system extracts text from each page using PyMuPDF . |
3οΈβ£ | Text Chunking: Extracted text is split into smaller chunks (with token limits). |
4οΈβ£ | Metadata Addition: Each chunk is enriched with metadata: chunk_index , page_number , text_start , text_end , source , etc. |
5οΈβ£ | Embedding Generation: Each chunk is passed through an embedding model (e.g., all-MiniLM-L6-v2 ) and stored in a vector database like ChromaDB . |
β | Ready for Querying: Admin-processed files are now available for user interaction. |
Step | Description |
---|---|
1οΈβ£ | File Selection: User selects a specific PDF file to query from the list of uploaded documents. |
2οΈβ£ | Input Method: User types a question or uses voice input (handled via react-speech-recognition ). |
3οΈβ£ | Embedding Query: User query is converted into an embedding and searched in the vector database (ChromaDB). |
4οΈβ£ | Top-k Retrieval: Most similar chunks are retrieved based on cosine similarity. |
5οΈβ£ | Contextual Prompt Construction: Retrieved chunks and metadata are appended to the query for contextual understanding. |
6οΈβ£ | Answer Generation: Query is sent to a language model (e.g., GPT-4) along with relevant context for accurate response generation. |
7οΈβ£ | Answer Display: Answer is rendered on the UI. Additional metadata like page number and similarity score is also shown. |
8οΈβ£ | PDF Viewer Sync (Bonus): The highlighted chunk is shown in the PDF viewer with react-pdf . |
β Bonus Features Implemented
- π Similarity Score Display
- π PDF Viewer with Highlighted Chunks
- ποΈ Voice Input Support
- π Admin-only Access for Upload & Embedding
Chat Interface | PDF Highlight |
---|---|
![]() |
![]() |
-
Clone the Repository
git clone https://github.com/shivamworld0608/Ollabot.git cd Ollabot
-
Create a .env file in backend
#OAuth Credentials GOOGLE_CLIENT_ID=87796226935-nr26lcqfgqfsoepgr3h30qc4nn224lqt.apps.googleusercontent.com GOOGLE_CLIENT_SECRET=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 #JWT Credentials JWT_SECRET="b1a26c4a14718e4244721cc7db67f6e42befce460c32f7e08f2040cb07ae4ed3" JWT_EXPIRES_IN="30d" JWT_COOKIE_EXPIRES_IN=30 #basic server credentials MONGO_URI="mongodb+srv://pandeyashishivam:[email protected]/" CLIENT_URL="http://localhost:5173" AI_ENGINE_URL="http://localhost:8000" SERVER_URL="http://localhost:5000" PORT=5000
-
Create a .env file in frontend
VITE_APP_BASE_URL='http://localhost:5000'
-
AI-Engine Setup (FastAPI)
cd ai-engine pip install -r requirements.txt python main.py
-
Backend Setup (Nodejs,Express)
cd backend npm i npx nodemon server.js
-
Frontend Setup (React)
cd frontend npm install npm run dev
Make sure to set the correct backend URL in your frontend env and also correct ai-engine url in backend env
We welcome contributions from the community! Hereβs how you can help:
-
π Open an Issue
For major features or changes, please open an issue first to discuss your ideas. -
π Follow Standards
Stick to the existing project structure and naming conventions for consistency. -
β Test Before Push
Ensure all features are tested and stable before submitting a pull request.
Have questions, feedback, or just want to connect? Feel free to reach out!
Platform | Link |
---|---|
GitHub | @shivamworld0608 |
[email protected] | |
linkedin.com/in/pandey-shivam- |