This project is a full-stack AI-powered document intelligence system that:
- Scrapes book data from the web
- Stores it in a structured database
- Enables intelligent question answering using a RAG (Retrieval-Augmented Generation) pipeline
- Scrape books using Selenium
- Store books in backend database
- Generate AI summaries
- User asks a question
- System retrieves relevant books (ChromaDB)
- LLM generates contextual answer
Example Query:
What is Sapiens about?
Output:
Provides a historical narrative of human evolution...
- Browse books
- View detailed book information
- Ask natural language questions
- Get AI-generated answers with sources
- Receive book recommendations
- Used LM Studio instead of OpenAI to avoid API costs and enable offline usage
- Implemented RAG instead of keyword search for better contextual answers
- Used ChromaDB for fast semantic similarity search
- Added caching to reduce repeated LLM calls
- π Automated book scraping using Selenium
- ποΈ Book storage using Django + SQLite/MySQL
- π Semantic search using Sentence Transformers
- π§ RAG pipeline using ChromaDB
- π€ AI-powered answers using local LLM (LM Studio)
- π Book recommendations via similarity search
- β‘ Response caching for faster queries
- π¨ Responsive frontend using Next.js + Tailwind CSS
- Django
- Django REST Framework
- Python
- SQLite / MySQL
- Requests
- SentenceTransformers (
all-MiniLM-L6-v2) - ChromaDB
- LM Studio (Mistral / Phi-3)
- Retrieval-Augmented Generation (RAG)
- Selenium
- ChromeDriver
- Next.js (React)
- TypeScript
- Tailwind CSS
- Axios
Scraper (Selenium)
β
Django Backend (API Layer)
β
Database (Books Metadata)
β
Embeddings (Sentence Transformers)
β
Vector DB (ChromaDB)
β
RAG Retrieval System
β
LM Studio LLM (Answer Generation)
β
Frontend (Next.js UI)
(use postman for post requests)
| Method | Endpoint | Description |
|---|---|---|
| GET | /books/ | Get all books |
| POST | /books/ | Add a new book |
| GET | /books// | Get book details |
| PUT | /books// | Update a book |
| Method | Endpoint | Description |
|---|---|---|
| POST | /ask-question/ | Ask AI question |
| GET | /books//recommend/ | Get similar books |
| GET | /load-rag/ | Load embeddings into vector DB |
| POST | /upload-book/ | Upload & process book |
- What is this book about?
- Recommend books similar to mystery genre
- Summarize the book description
- Which books are best for fiction lovers?
git clone https://github.com/your-username/AI-Powered-Book-Insight.git
cd AI-Powered-Book-Insight-
Open LM Studio
-
Load model:
phi-3-mini-4k-instruct(recommended)
-
Start server at:
http://localhost:1234
cd ai_book_project
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txtRun migrations:
python manage.py migrateStart server:
python manage.py runserverGET http://127.0.0.1:8000/load-rag/
π This generates embeddings and stores them in ChromaDB
python scraper.pycd frontend
npm install
npm run devFrontend runs at:
http://localhost:3000
- Open frontend
- Ask:
What is Sapiens about?
π If AI answers β β SUCCESS
You can test the backend endpoints using Postman.
Method: GET
Method: GET
http://127.0.0.1:8000/books/1/
(Replace 1 with a valid book ID)
Method: GET
http://127.0.0.1:8000/books/1/recommend/
Method: POST
http://127.0.0.1:8000/ask-question/
Body β raw β JSON
{ "question": "What books are related to mystery?" }
Method: POST
http://127.0.0.1:8000/upload-book/
Body β raw β JSON
{ "title": "Test Book", "price": "$20", "rating": "Four", "link": "http://example.com/book", "description": "A mystery novel about a detective.", "summary": "A detective investigates a strange crime.", "genre": "Mystery" }
User asks:
Recommend me books like mystery novels
System:
- Converts query β embedding
- Searches ChromaDB
- Retrieves relevant chunks
- Sends context to LLM
Output:
- AI-generated answer
- Source books displayed
- Overlapping chunking for better retrieval
- Embedding-based semantic search
- Cached responses for faster queries
- Structured prompt engineering
- Clean REST API design
- Responsive frontend UI
-
Slow AI response time β Solved using caching + limited batch processing
-
ChromeDriver compatibility issues β Fixed by matching browser version
-
Large context handling in RAG β Solved using chunking with overlap
-
API failures during scraping β Added error handling and retries
- Async processing using Celery
- Docker deployment
- User authentication system
- Hybrid search (BM25 + embeddings)
- Ensure LM Studio is running before asking questions
- First RAG load may take time (
/load-rag/) - ChromeDriver must match Chrome version
Built as part of a Frontend/Backend AI Internship Assignment
If you like this project, give it a β on GitHub!


