Skip to content

Latest commit

 

History

History
298 lines (215 loc) · 5.4 KB

File metadata and controls

298 lines (215 loc) · 5.4 KB

📚 AI Book Insight Assistant

An AI-powered full-stack application that allows users to:

  • 📖 Browse a dashboard of scraped books
  • 🔍 View detailed information about each book
  • 🤖 Ask AI questions about books and receive intelligent answers
  • 🧠 Use Retrieval-Augmented Generation (RAG) with ChromaDB
  • 🏠 Run a local Large Language Model (LLM) using LM Studio

This project combines web scraping, vector databases, Django REST APIs, and a modern React frontend to create a real-world AI application.


✨ Features

📚 Book Dashboard

  • Displays all scraped books in a responsive card layout
  • Shows title, author, rating, and description
  • Includes links to the original book pages

📖 Book Detail Page

  • Displays detailed information about a selected book
  • Provides a direct link to the original source
  • Includes navigation to the AI Q&A page

🤖 AI Book Insight Assistant

  • Ask questions such as:

    • Summarize a book
    • Recommend similar books
    • Explain themes and characters
  • Uses RAG to retrieve relevant book data

  • Generates answers using a locally hosted LLM in LM Studio

🧠 Retrieval-Augmented Generation (RAG)

  • Sentence Transformers create embeddings
  • ChromaDB stores vector representations
  • Relevant book data is retrieved before querying the model

🌐 REST API

  • Built with Django REST Framework

  • Provides endpoints for:

    • Listing books
    • Retrieving book details
    • Asking AI questions

🛠️ Tech Stack

Backend

  • Python
  • Django
  • Django REST Framework
  • SQLite
  • ChromaDB
  • Sentence Transformers
  • OpenAI Python SDK
  • python-dotenv

AI & LLM

  • LM Studio
  • Phi 3.1 Mini 4K Instruct

Frontend

  • React
  • Vite
  • Tailwind CSS
  • Axios
  • React Router DOM
  • React Hot Toast

📂 Project Structure

bookidentifier/
├── backend/
│   ├── ai_insights/
│   ├── backend/
│   ├── books/
│   ├── chroma_db/
│   ├── media/
│   ├── rag/
│   │   └── query_books.py
│   ├── scraper/
│   ├── venv/
│   ├── .env
│   ├── db.sqlite3
│   ├── manage.py
│   └── requirements.txt
│
└── frontend/
    ├── public/
    ├── src/
    │   ├── assets/
    │   ├── pages/
    │   │   ├── Dashboard.jsx
    │   │   ├── BookDetail.jsx
    │   │   └── HomePage.jsx
    │   ├── App.jsx
    │   ├── App.css
    │   ├── index.css
    │   └── main.jsx
    ├── package.json
    ├── tailwind.config.js
    ├── postcss.config.js
    └── vite.config.js

🔌 API Endpoints

Method Endpoint Description
GET /api/books/ Get all books
GET /api/books/<id>/ Get book details
POST /api/ask/ Ask AI questions

Example Request

{
  "question": "Recommend books similar to A Himalayan Love Story"
}

Example Response

{
  "question": "Recommend books similar to A Himalayan Love Story",
  "answer": "Based on the themes of adventure and self-discovery..."
}

🚀 Setup Instructions

1️⃣ Clone the Repository

git clone https://github.com/your-username/bookidentifier.git
cd bookidentifier

⚙️ Backend Setup

Create Virtual Environment

cd backend
python -m venv venv

Activate Virtual Environment

Windows PowerShell

.\venv\Scripts\Activate.ps1

Install Dependencies

pip install -r requirements.txt

Apply Migrations

python manage.py migrate

Run Django Server

python manage.py runserver

Backend runs at:

http://127.0.0.1:8000/

🧠 LM Studio Setup

  1. Install LM Studio
  2. Download and load Phi 3.1 Mini 4K Instruct
  3. Open the Developer tab
  4. Start the Local Server
  5. Ensure the server is reachable at:
http://127.0.0.1:1234

.env Configuration

Create a .env file inside backend/:

LM_STUDIO_URL=http://127.0.0.1:1234/v1
LM_STUDIO_API_KEY=lm-studio
LM_STUDIO_MODEL=phi-3.1-mini-4k-instruct

🎨 Frontend Setup

cd ../frontend
npm install
npm run dev

Frontend runs at:

http://localhost:5173/

📸 Screenshots

Dashboard

Dashboard

Book Detail

Book Detail

Q&A Interface

Q&A Interface

AI Answer

AI Answer

🎯 Example Questions

  • Summarize A Himalayan Love Story
  • Recommend books similar to A Himalayan Love Story
  • What are the main themes of this book?
  • Suggest books about adventure and self-discovery

🏆 Key Concepts Demonstrated

  • Full-Stack Development
  • REST API Design
  • Web Scraping
  • Vector Databases
  • Sentence Embeddings
  • Retrieval-Augmented Generation (RAG)
  • Local LLM Integration
  • React Routing
  • Modern UI Design

👩‍💻 Author

Yamini Priyadarsani Behera


🌟 Acknowledgements

  • Django REST Framework
  • React
  • Tailwind CSS
  • ChromaDB
  • Sentence Transformers
  • LM Studio
  • Microsoft Phi-3