# Day 9 - Feb 1 2026

Move from transient memory (scripts) to persistent knowledge storage using a Vector Database.

### 1. Why do we need a Vector DB?

Yesterday, I calculated similarity manually. That works for 5 items. But if I want to search through Wikipedia (6 million articles), calculating cosine similarity for every single page would take hours.

* Vector Database (Chroma/Pinecone/Milvus): These databases use special indexing algorithms (like HNSW) to find the "Nearest Neighbors" in milliseconds, even among millions of records.

### 2. Key Components

* Collection: Equivalent to a "Table" in SQL. It groups related vectors together.
* Documents: The actual text content we want to store.
* IDs: Unique identifiers for each document (e.g., `doc1`, `page_5`).
* Metadata: Extra info attached to the vector (e.g., `{ "source": "textbook.pdf", "page": 10 }`). This allows for filtering later.

### 3. The "R" in RAG

This is the foundational step for Retrieval Augmented Generation.

1. User asks question.
2. Convert question to Vector.
3. Search Vector DB (This step).
4. Send result to LLM.

Today, I successfully built the storage engine (Steps 2 & 3).

### Status:

* [x] Installed ChromaDB
* [x] Connected Ollama Embeddings to Chroma
* [x] Created Persistent Knowledge Base on disk
* [x] Successfully queried "Coding" to find "Python"


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://shankar-lab.gitbook.io/mylearning/15-days-genai-learning-challenge/day-9-feb-1-2026.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
