Lannon Khau

Octopus Books

Blue Scorpion
Lannon Khau

By Lannon Khau

· 5 min read
O ctopus Books is an AI-powered reading companion that lets you upload any book, chapter, or manuscript and have a thoughtful, memory-rich conversation with it. Powered by GPT-4o, LangChain, and real-time document embeddings, the app remembers everything you've discussed and pulls context from across the pages so you can reflect, question, and explore ideas as deeply as you like.

🧠 Live Architecture

  • Streamlit Cloud: Serves the conversational reading app with a sleek, reactive UI
  • LangChain: Orchestrates RAG pipeline and manages chat memory per session
  • ChromaDB (Local): Stores embedded chunks from uploaded books for fast retrieval
  • OpenAI GPT-4o: Powers real-time, context-aware responses from your book
  • Session Memory: Maintains ongoing chat history to simulate deep, evolving conversations
  • Temporary File Storage: Uploaded PDFs processed securely and discarded after use

Backend

Python Python
LangChain LangChain (RAG)
ChromaDB Chroma (Vector Store)

Frontend

Streamlit Streamlit
HTML Minimal HTML

AI Engine / Function Calling

GPT-4o OpenAI GPT-4o
LangChain Prompt + Output Parsers
PyPDF PyPDFLoader

Infrastructure

Streamlit Cloud Streamlit Cloud
SQLite SQLite3 (local logging)

CI / CD

GitHub Actions GitHub Actions

πŸ§ͺ How It Works

Step 1: Upload a Book

Drop in any PDF to begin

Start by uploading a PDF of a book, manuscript, or article. Octopus Books processes it instantly and prepares it for exploration.

Step 2: Slice & Embed

Convert text into searchable memory

The app splits your book into overlapping chunks and stores them as vector embeddings using ChromaDB for fast, meaningful retrieval.

Step 3: Ask Anything

Converse with your book

Ask thoughtful or specific questionsβ€”per chapter, per theme, or across the entire text. GPT-4o generates responses using both your query and the retrieved context.

Step 4: Track the Thread

Every chat deepens the narrative

Each conversation is saved in session memory, so the more you ask, the richer and more context-aware your book becomesβ€”like reading with a brilliant friend.

Step 5: Reflect & Rediscover

Unlock new layers in the text

Use Octopus Books to reread, reframe, and reimagine your favorite works. Ask what you missed, test theories, or trace characters through the plot.


"I always wanted a way to explore my favorite books more deeply. Octopus Books makes it feel like the story is thinking back." - Maya Zhou

πŸ“ Repository Structure

Octopus_Books_V2/
β”‚
β”œβ”€β”€ ebook_tutor.py           # Streamlit app for chatting with uploaded books
β”œβ”€β”€ requirements.txt         # Python dependencies for LangChain, OpenAI, Streamlit
β”œβ”€β”€ README.md                # Project overview and usage instructions
β”œβ”€β”€ LICENSE                  # Open source license
β”œβ”€β”€ .gitignore               # Ignores environment files, __pycache__, etc.
β”œβ”€β”€ .gitattributes           # GitHub linguist and text file handling config
└── .DS_Store                # (macOS file β€” safe to ignore or delete)
            

πŸ“ Run Locally

git clone https://github.com/LannonTheCannon/Octopus_Books_V2.git
cd Octopus_Books_V2
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
streamlit run ebook_tutor.py