📚 Import Kindle books into a vector database and ask questions about them using AI.
- Import books from text files or via Kindle Cloud Reader automation
- Ask questions about your books using natural language
- Interactive chat mode for conversational Q&A
- Vector search powered by ChromaDB for fast, relevant retrieval
- RAG-powered answers using OpenAI GPT-4o-mini
pip install -r requirements.txt
# For Kindle Cloud Reader automation, also install:
playwright install chromiumCopy .env.example to .env and add your OpenAI API key:
cp .env.example .env
# Edit .env and add your keyGet an API key from: https://platform.openai.com/api-keys
Option A: From a text file
python app.py import --file "path/to/book.txt" --title "Book Title"Option B: From Kindle Cloud Reader (automated)
python app.py import --cloud-reader --title "Book Title"python app.py ask "Book Title" "What is the main theme of the book?"python app.py chat "Book Title"| Command | Description |
|---|---|
import |
Import a book from file or Cloud Reader |
ask |
Ask a single question about a book |
chat |
Start an interactive chat session |
list |
List all imported books |
info |
Show info about a specific book |
delete |
Remove a book from the database |
- Extract: Text is extracted from your Kindle book (via file upload or Cloud Reader automation)
- Chunk: Text is split into overlapping chunks for better context
- Embed: Each chunk is converted to a vector embedding using OpenAI
- Store: Embeddings are stored in ChromaDB for fast similarity search
- Query: Your questions are embedded and matched to relevant chunks
- Answer: GPT-4o-mini generates answers based on retrieved context (RAG)
Since Kindle books are DRM-protected, you have several options:
- Copy & Paste: Open the book in Kindle app, select text, and paste into a
.txtfile - Kindle Cloud Reader: Use the
--cloud-readerflag to automate extraction from read.amazon.com - Notes & Highlights: Export your Kindle notes/highlights via Amazon
- Embeddings:
$0.00002 per 1000 tokens ($0.01 per 100 pages) - Q&A: ~$0.0001 per question using GPT-4o-mini
MIT