Video by freeCodeCamp.org · streamed from YouTube. All rights remain with the creator.
Lesson 1: Vector Databases and Search by Meaning
About this lesson
Vector databases sit underneath much of modern AI, from chat assistants that answer questions about your own documents to systems that recommend similar items. This lesson explains them from first principles in six parts and ends with a working project. It begins with the mathematics: what a vector is, and how measures of similarity tell you whether two vectors point the same way. The second part covers tokens and tokenization, the step in which text is cut into pieces a model can process. Part three introduces embeddings and embedding models, showing how a sentence becomes a list of numbers that captures its meaning, so that related sentences land near each other. In part four you generate real embeddings yourself by calling an embedding model from Google's Gemini family. Part five opens up the vector database itself and looks at how it stores vectors and finds the nearest ones quickly without comparing against every item. The final part is hands-on: using ChromaDB you create a client and a collection, store embedded documents, and run queries that return results by meaning instead of by matching words, which together make a small semantic search engine. Some Python is useful for the coding sections, although the concepts are explained visually and can be followed without it. No earlier machine learning study is required. When you finish, read Chapter 1 of the course book, which works through cosine similarity by hand, estimates how much memory a million vectors need, and explains when search by meaning falls short.