Han's Generative AI Quest

Pepper & Carrot AI-powered flipbook · Part 9 — Spoiler-Safe RAG: Secure Retrieval That Doesn't Trust the Prompt

Post 9 of the Pepper & Carrot AI flipbook series. The flipbook from Post 8 knows which page you're on. Now we build the chat pipeline that answers questions about that page — and we make spoiler safety a property of the database query, not a line in the prompt. Build a RetrievalService whose Chroma filter is derived from server-side reading progress, wire it into a FastAPI chat endpoint, drive it with curl, and prove the boundary holds even when the user tries to jailbreak it. No chat UI yet — that's Post 10.

Pepper & Carrot AI-powered flipbook · Part 8 — A React Flipbook in the Browser: StPageFlip and a Page-Turn UI

Post 8 of the Pepper & Carrot AI flipbook series. Post 7 built two typed REST routes that return episode JSON with absolute image URLs; this post renders that data as a real page-flipping flipbook in the browser. A Vite + React + TypeScript frontend, a hand-rolled types.ts that mirrors the Pydantic models, an episode picker, and a wrapping StPageFlip — single page in portrait, two-page spread in landscape. Ends with appendices on the SQLAlchemy idioms behind the handlers and how Settings reads your .env.

Pepper & Carrot AI-powered flipbook · Part 7 — Building a Typed REST API: From Database to JSON

Post 7 of the Pepper & Carrot AI flipbook series. With one episode sitting in Postgres + LocalStorage from Post 5, it's time to surface it. Build two typed FastAPI routes — list episodes and episode detail — that resolve relative storage keys into absolute URLs at response time via the Storage Protocol, with the OpenAPI spec as the wire-format contract. By the end you have two endpoints returning episode JSON your browser can consume.

Pepper & Carrot AI-powered flipbook · Part 6 — Building an Embeddings Ingestion Pipeline: From Page JSONs to Postgres + Chroma

Post 6 of the Pepper & Carrot AI flipbook series. Post 5 built the ingest-from-images skill that writes one JSON description per page; this post is the Stage-2 Python pipeline that consumes those JSONs — image variants via Pillow, uploads through the storage abstraction, pages and page_characters rows, a per-episode plot summary, and embedded chunks in ChromaDB's pages_v1 collection. By the end, one full episode is ingested end-to-end, with the two-stage design, the recovery story, and the reproduction recipe all walked through.

Pepper & Carrot AI-powered flipbook · Part 5 — Claude Skills as a Vision Provider: Ingesting a Comic by Reading It

Post 5 of the Pepper & Carrot AI flipbook series. The comic is images, not text — so before any RAG can happen, every page needs a description. This post is about who writes those descriptions: a tour of the three vision-provider options (local VLM, hosted API, Claude Code itself), why the Claude Code path wins for a portfolio project, and a section-by-section walk through the `ingest-from-images` skill that produces a JSON description per page. The right vision provider is context-specific, and the post includes a decision matrix mapping each constraint to the right choice — plus an appendix on how a VLM actually sees an image.

Pepper & Carrot AI-powered flipbook · Part 4 — LLM Provider Abstractions: Why Every External Service Hides Behind an Interface

Post 4 of the Pepper & Carrot AI flipbook series. Build three typed Protocol interfaces — Storage, EmbeddingClient, ChatClient — and the factory that picks the right implementation from a .env file. By the end you have LocalStorage serving images end-to-end and a working embedding client producing real 1024-dim vectors against the local Ollama you set up in Post 2.

Pepper & Carrot AI-powered flipbook · Part 3 — Designing the Postgres Data Model: Ten Tables, One Migration, Zero Surprises

Post 3 of the Pepper & Carrot AI flipbook series. Post 2 stood up Postgres and applied the first migration; this post explains what that migration created and why. How Alembic works, why not Base.metadata.create_all(), how ten tables map one-to-one onto product features, four design decisions that pay off later, and a column-by-column tour of the SQLAlchemy 2.0 models.