+++ title = "vector-db" priority = 5 status = "todo" ticket_type = "project" dependencies = ["21d9be", "584e0c", "99e1d9", "d9f850", "6ec5ff", "37cdd5", "081a55", "5674ce", "4c961f", "1ef9f4", "e8be9a", "5ed295"] +++ ## Project: Vector Database Self-Guided Course This is the top-level project ticket for `edu/src/vector-db.md` — a self-guided mdbook course on vector databases in the **Vibed Learning** site (`edu/`). The course is modelled on `edu/src/markov.md`. It teaches vector databases through 12 sections across 4 parts, mixing reading lessons and hands-on Rust programming exercises using Turso (`libsql` crate) and sqlite-vec for local vector storage. ## Course structure | # | Title | Status | |---|---|---| | §1 | What Is a Vector? | Written in full | | §2 | Embeddings | Stub [nbd:584e0c] | | §3 | Vector Similarity | Stub [nbd:99e1d9] | | §4 | What Is a Vector Database? | Stub [nbd:d9f850] | | §5 | Under the Hood: ANN Algorithms | Stub [nbd:6ec5ff] | | §6 | Setting Up | Written in full | | §7 | Exercise 1 — Storing and Retrieving Vectors | Stub [nbd:081a55] | | §8 | Exercise 2 — K-Nearest Neighbor Search | Stub [nbd:5674ce] | | §9 | Generating Embeddings in Rust | Stub [nbd:4c961f] | | §10 | Exercise 3 — Semantic Document Search | Stub [nbd:1ef9f4] | | §11 | Exercise 4 — Recommendation Engine | Stub [nbd:e8be9a] | | §12 | Exercise 5 — Retrieval-Augmented Generation | Stub [nbd:5ed295] | ## Filling a stub 1. Open `edu/src/vector-db.md` 2. Find the section (e.g. `### 2. Embeddings`) 3. Replace the stub line (`🚧 Full content tracked in [nbd:...]`) with full content 4. Run `mdbook build` from `edu/` — must pass cleanly 5. Mark the section ticket done ## Tech stack used in exercises - **Runtime:** Tokio async - **DB crate:** `libsql = "0.9"` (Turso / libSQL Rust client) - **Vector support:** sqlite-vec, built into libsql — no extra install - **Embeddings:** `fastembed` crate (local) or OpenAI-compatible HTTP API - **Local connection:** `Builder::new_local("vectors.db").build().await?` - **Vector column type:** `F32_BLOB(d)` where d = embedding dimension - **KNN query:** `vector_top_k('table', vector('[...]'), k)` table-valued function - **Distance function:** `vector_distance_cos(a, b)` — 0 = identical, 2 = opposite This project ticket closes when all 12 section tickets are done and `mdbook build` passes.