Skip to content

YAM1234-B/AI-Book-Insight-Assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors