Vector Databases Full Course for Beginners – Embeddings, Similarity Search & ChromaDB

#Vector Databases #Embedding Models #Semantic Search #Cosine Similarity #Chroma DB #AI Applications #RAG
💬 Chat with this Video
Ask anything about this video…
This beginner course teaches vector databases from scratch, starting from vectors, cosine similarity and Euclidean distance. Next we will move on to tokenization and embedding models. You will generate embeds in real time using Google's Gemini model and see how a vector database works from the inside, including storage, indexing and types of IVF indexes and HNSW. The course concludes with a project where you store embeddings in Chroma DB and you will run a semantic search that finds matches by content, not by keywords. So, if you want to learn vector databases at a time, this video is for you . In this video I will literally guide you I will take your hand and teach you everything from scratch. None no prior knowledge is required. I am 15. years of experience as a developer software and 4 years on as a lead AI engineer. AND let me tell you that vector bases data—this is what you need to know in 2026 year, regardless of whether you software developer, AI engineer or engineer machine learning. Today such technologies like AI agents, recommender systems, RAG applications and corporate knowledge bases, based on one key concepts—vector databases. So by the end of this video you will not only understand the concept of vector databases , but also gain practical work experience with them. Here's what we'll look at. In the first chapter we'll break down the basics. What is a vector database? Why were they there? vector databases implemented? As do they work from the inside? Why they became one of the most important technologies in the AI ​​era? We will also look at some real use cases that companies used today. In the second section we will take a step back and we will understand what a vector is, because before learning vector databases you must understand vectors and vector similarity. In the third chapter we will delve into the world tokens and tokenization. You will learn what tokens are, why AI models don't understand raw data text, why tokens are not the same as words, and how tokenization becomes the first step in the embedding pipeline. In the fourth chapter you will learn how text is converted to vectors as it conveys meaning and context, how it works vector mathematics, and we will also consider embedding models used in modern AI systems. In the fifth chapter we will work with Google Gemini model, where we will see the full demonstration of vector generation embeddings. And then in chapter six we'll delve deeper inside the vector database. We will reveal the internal architecture, storage mechanisms, strategies indexing, similarity search algorithms and how these systems scale to billions of vectors, while maintaining extremely high performance. And finally, in the seventh chapter we let's combine everything into a holistic practical project. We will generate embeddings, we will store them in Chroma DB and we will perform semantic search by using vector similarity so that you saw the entire workflow in action. If you want to master vector bases data, this video is for you. Therefore, take a cup of coffee, open it notepad, and let's master it together vector databases from scratch to pro. So let's begin. Today is the first day of the "Vector" series. databases: from zero to hero. In this video we will explore what is vector database, how it works and why do we need vectors at all databases? What is the need for vector databases? AND we will also consider some options using vector databases. So let's begin. Okay, let's start with the definition of vector databases. A vector database is a database that intended for storage, indexing and multidimensional vector search embeddings created by models embeddings, which allows for semantic search. At first glance, this definition may seem a bit confusing, and that's entirely okay, because it hides a few fundamental concepts on which vector databases are based. And I'm sure that in your inquisitive Several questions have already arisen in my mind, for example: what are these multidimensional vector embeddings? Isn't that right? And how are these vector embeddings generated? embedding models? And what do we really mean by semantic search? Isn't that right? So, these are some questions that may arise at this stage. And when we deal with all these concepts, right? Deeper questions will begin to arise, for example: as vector databases index these multidimensional vector embeddings? Or how we manage to search so effectively among these multidimensional vector embeddings? Isn't that right? So these are the key concepts that we will to disassemble and understand step by step under course time. So if at this stage of the definition seems a bit confusing, it's quite normally. Be sure that by the end of this course all these concepts will become crystal clear understandable. Now in this lecture let's delve deeper one level lower and we'll understand how vector database works step by step step by step. By the end of this lecture you will clearly understand the entire vector database workflow . At a high level, almost every vector the database follows the same main conveyor regardless of developer. So let's break it down. First, we take our original data. This can be text, images, documents, code or anything else, and then we pass them through the embedding model . Now, what is an embedding model? The embedding model is a machine learning model. learning that converts data into numbers in such a way as to preserve their content. So, the task of the embedding model is simple . It converts the original data into a long list of floating-point numbers. Now, what are these floating-point numbers? These numbers reflect the content of the initial data. They are also called vector embeddings. Don't worry about them now, because we will have a separate lecture, but for now just know: this means that two objects with similar content will have vector embeddings located close to to each other in vector space. Okay, these vector embeddings stored in a vector database, but not separately. You can save links with them. for the original content, as well as additional metadata. Now I want you to stop for a moment. and imagined what you have in this database a million images are stored. To find the most similar images to request, you will have to review the entire million, and it will be very slow operation with high complexity O(n), since it is a linear search. So, to speed up the search, vector databases perform vector indexing . And this is where the real magic happens. Instead of looking at millions of vectors on in turn, the database builds indexes by using various approximation algorithms search for nearest neighbors to make similarity search extremely fast. Don't worry about vector indexing now, since we will have a separate lecture , where we will consider all the algorithms approximate search for nearest neighbors. Different databases use different methods, but the goal is always the same. Fast and accurate search. So, everything we discussed, occurs at a stage we call ingestion phase. Now let's see what happens when the user makes a request. When a user or application sends query, for example, "How to improve concentration?" we pass this request through the same embedding model. I want you to stop for a moment and wondered why because of the same model . This is because all embeddings have to be in the same vector space to be comparable. This is why we need to use here is the same embedding model. So, just query embeddings generated, they are used for searching in a vector database. So here the vector database is internally searches for vectors that are most similar to this one query vector or query embedding. When the nearest neighbors are found, at the stage post-processing results are ranked by similarity indicator, and if necessary metadata filters are applied. And finally, the top K most are back relevant results. This concept that we just mastered, lies at the heart of your semantic search, recommendation systems, RAG- pipelines and modern GPTs. So, to summarize, we can divide the entire conveyor into two phases. Data acquisition phase and search phase. Of course, different vector databases optimize this process in different ways, but the basic idea remains the same. So why do we need vector bases? data? Before understanding the need for vector databases, let's look at the types the data we have today, right? ? First, we have structured data, True? It's like tables, rows, a fixed schema, isn't that right? So, this is all structured data, right? Then we have semi-structured data, isn't that right? Like JSON, logs, events, and we also have unstructured data. For example, your texts or PDF files, audio, video, images, right? This is unstructured data, right? Is this data actually multidimensional? wrong? They are unstructured, and this data based on meaning, right? The fact is that traditional databases can't store this data, right? You can save them, but you can't store this data at scale and search for them. Yes? This is where traditional databases and are facing difficulties. Therefore, vector databases are mainly targeting this unstructured data. We can store these unstructured data in vector databases. Okay, now you might ask, "Okay , what is the problem with traditional databases data?" Why can't we, you know, look for these unstructured data in traditional databases data? Because the problem is that traditional databases perform keyword searches in words, right? Because these traditional databases optimized for exact matches, right? You can perform a precise search by keyword in traditional databases, or query ranges, joins, and transactions, right? But the limitations of traditional databases is that they don't understand the value of the data you are storing is correct ? So if keyword search doesn't will work, traditional databases won't will be able to obtain information that stored inside, right? So, for example, if you try save a PDF file, the only thing you can do here to do—is to perform a keyword search words, but if this keyword not in the file, so what? Even if the user's intent matches , the system will not be able to obtain information, because you can only search here by keywords, not semantic or semantic search, right? This is the main limitation of traditional databases. data. Instead, in a vector database you can perform semantic search. So, you can search for this information. Any information you have stored here , can be searched based on its content. Yes ? This is the power of vector databases. Okay, now let's try to go deeper and understand what exactly distinguishes vector databases from traditional ones. Yes? So, vector databases are designed for storage of multidimensional vectors. You can store even thousands measurements in vector databases, or not Yes? So you can store multidimensional vectors. We will understand what a vector is. , later in this course. For now, just understand what we can store multidimensional vectors in vector bases data, right? And these vector databases use vector indices. They apply the concept clustering and vector search, yes ? To optimize this search and make its more effective, right? Using these algorithms also makes Search is effective, right? So the advantage we get is quick search. It allows you to search millions of vectors by milliseconds, right? While preserving the semantic meaning , right? That's what makes a vector database so great. effective. Even if you have millions of documents , right? It can perform searches efficiently thanks to these vector indices. Now we will look at all of them in detail later. these vector indexing methods, which exist in vector databases. But now understand why the search is like this effective thanks to these vector indexes, right? Here is the main point. So, vector bases data are scalable because they avoid brute force, right? They are not they search linearly, right? They avoid brute force searches, instead use smart indexing and methods of approximate search for the nearest neighbors to find similar elements in milliseconds. This is a very important concept—methods approximate search for nearest neighbors, and we will consider all these methods separately, but now this is what really feeds your vector databases. And this is a very important point that should be mark now, right? This is the concept on which vector graphics are based. databases. So, let's summarize the differences between traditional relational databases, that we have, and vector databases , right? Traditional databases work on the basis of rows and columns, right? You can store your data according to a certain fixed pattern in the lines and columns. You can search by keywords words. And the search is mostly done by using where operators. And it depends on the scheme, right? That's not very flexible, is it? This is scheme driven. So, this is what we we already know about traditional databases. Whereas vector databases can store vectors and embeddings. What are vectors and embeddings? We we'll look at this in the next lectures, okay ? What are vectors and what are embeddings, Yes? Therefore, vector databases can store these vectors and embeddings. They can search by similarity, again, this is a new a term we will consider later. What is similarity search? And it uses search algorithms nearest neighbors, again, we we'll look into this later: what is this? algorithms and how they are used for similarity search. And most importantly, vector bases data, right? Because they can store all these vectors and embeddings, we can perform a content search here, right? So, in a vector database, that's all semantic search, right? These are the main differences between traditional database and vector database. Okay, now it's important to note that vector database, right? Your vector database does not replace traditional databases, right? So, in real applications, right? It a typical configuration you will encounter. Traditional databases still used as a data recording system . Whereas vector databases used to create a layer semantic search on top of yours traditional databases, right? So, today in any real applications they are used together . Okay, now let's look at some cases of using vector databases. Vector databases are active used in the creation recommender systems. They are used to create NLP-based search where you can search using natural language. The same technique is also used for building RAG conveyors to provide more LLM context. Therefore, vector databases provide the operation of these RAG conveyors. Next, they also used to create fraud and anomaly detection functions . These are just a few examples of use, which I wanted to highlight, but there are many more similar options that can be implement using vector bases data. Now in this lecture we will analyze how they used for construction recommender systems. So, vector databases used for system operation recommendations that you may have seen on popular platforms such as Netflix , Amazon or YouTube. So all these recommendation systems that you you see on these platforms, actually work on the basis of vector databases. The working principle is that as both users and objects are converted into vectors. The user vector is nothing more than user behavior, for example, what they click, they look, what's in them viewing history or purchase history. This user behavior is actually stored inside a vector user. And there are also vectors of objects, for example, movie reviews, product reviews or, let's say, actual characteristics product. All these things, all these signs—this is really your object vectors. So, both users and objects are converted into vectors and stored in a vector database. And then, having this data in a vector database, you can search for similarity by using algorithms to find the nearest neighbors to provide users with relevant recommendations. Here's how you can create systems recommendations using such vector databases. So, to sum up, we have already done a lot What was covered in this video: we figured it out , what is a vector database, how does it work works, understood the need for vector databases, and also reviewed several cases of their use. I hope this video was for you. useful. In the next lecture we will learn that such vectors, and also analyze the important the concept of vector similarity. Thank you for watching. Hello everyone, congratulations you again. Today is the second day of the series " Vector databases: from zero to hero" . In this video we will explore what is vectors, and also understand what exactly are vector similarity metrics . So let's begin. Earlier in this course we learned that embedding models generate vector embeddings. Now, before explaining vector embeddings, let's first understand, What are vectors? So when you hear the term "vector" that comes to mind ? Maybe you remember math lessons. or physics. And that's fine, but in the world of machine learning learning and vector databases vector has a very specific and powerful application. So, in machine learning, a vector is a one-dimensional array of numbers. It's just a one-dimensional array of numbers. Where each number represents a certain characteristic of the object. Of course? This is the definition of a vector in machine language. learning and vector databases. OK? Now let's look at a few examples to consolidate this concept. OK? So, for example, this—all of this real examples of vectors. It one-dimensional vector. Similarly, this is a two-dimensional vector , and this is an n-dimensional vector. Why are they all real vectors? Because if you look closely, they all are one-dimensional arrays of numbers. So, this is one-dimensional array. Even this— one-dimensional array. So this is the main thing to remember: this should be a one-dimensional array where each dimension, for example, like here, is two dimensions . So, these 1.1 and 2.3 are actually represent the features of the object. Now let's look at some invalid ones. examples. For example, this. This is not a vector. Vectors represented by a one-dimensional array, and this just a number, which is nothing more than scalar. Next you have this two-dimensional array. It a two-dimensional array, also known as matrix. This is not a one-dimensional array. Therefore , this is not a valid example of a vector. It matrix. Then you have this. It three-dimensional array. This is not one-dimensional. massif. This is a three-dimensional array. Again yes, this is not a valid example of a vector . So, these are all invalid examples. vectors. That's what I wanted to highlight here, so difference between vector and examples that are not vectors, was quite clear. I think you understand from this difference that a vector is simply a one-dimensional array numbers. OK? So remember this. Now, before we continue, here's question for you. Are these vectors, whatever you see here, these are valid examples of vectors, are they embeddings? Well, not necessarily. Not all vectors are vector embeddings. We will consider, what are vector embeddings, later in another lecture. So don't assume that all vectors are vector embeddings. These are all valid. examples of vectors, but not all vectors are vector embeddings. OK? So this is worth keeping in mind. Now there is another part of this definition : each number represents a feature of the object . And that's why they're also called vectors. signs. So, now that we know that such vectors, let's understand that we we mean by measurement. For example, this is a one-dimensional vector. This is a two-dimensional vector. What does this really mean? So the number of dimensions is simply number of features contained in the vector . Here you see a two-dimensional vector, and this is means that we consider two features in this vector, okay? To make the idea of ​​signs a little clearer, let's start with specifics real-life examples. Let's try to describe the car only by one sign, okay? We can introduce car A and its sign using a vector. This is a one-dimensional vector, where the feature that we consider, there is speed. So this car A can be represented on the number line and label it, let's say here. Car A we represent for using a one-dimensional feature vector, where the speed is 180. Now Let's look at a few more cars. Let's say we have car B and car C. The speed of car B— 160. We present it again for using a one-dimensional feature vector, and The speed of the car C is 80. Again , represented by one-dimensional feature vector. And if you look here, we marked them on number line. Now here's what It is important to note: cars with similar will be closer to each other in speed, while cars at different speeds— further. This is a very simple example where we we consider only one feature that can be to represent by a one-dimensional feature vector . Now let's try adding another feature. Along with speed, we now take into account, let's say, mileage. So now this is a two-dimensional feature vector . A two-dimensional feature vector can be to display on a two-dimensional plane. You may notice that cars with similar speed and mileage will group closer together, while cars with different performance will be further apart. Now let's develop this example further and let's try to add more one sign. Let's add a price tag. Now we consider three signs car: speed, mileage and price. It can be represented using three-dimensional feature vector. Now you can build a three-dimensional feature vector in 3D space. Again, the concept is similar. All cars that have similar speeds , mileage and price, will be grouped together in 3D spaces, and cars with excellent indicators will be located further. This is how it can be displayed in 3D spacious. The thing is that in real systems machine learning we don't stop at four signs. We will later learn that models embeddings can be supported today up to 3000 measurements. So these are extremely high-dimensional vectors. The car can be presented for with the help of a much larger number attributes. We can take into account the safety of the car, its weight, brand and use n-dimensional feature vector to represent all of its characteristics. And we can use the same concept apply even to n-dimensional space. We can build it in n -dimensional vector space. Of course, outside the three-dimensional vector visualization becomes difficult, but the concept remains unchanged. So even in n-dimensional space—this three-dimensional plane, but imagine it's n -dimensional plane. Even in the n-dimensional plane, they are similar vectors will be grouped together, and different ones— will be further apart. This is the same concept that can be apply to n-dimensional vector space. Why is this concept important and interesting? When we study vector later embeddings, you will see that the models generate embeddings that are, say, 3000-dimensional vectors. And obviously, this is something that can be built in a 3000-dimensional vector space. And any intuition I tried here build—from one-dimensional to three-dimensional and four-dimensional—you can apply even to n-dimensional vectors. In just a few minutes we will learn about similarity metrics. So any concept you bring up from similarity metrics for one-dimensional vectors, can also be applied to n- dimensional vector space. That's why this concept, the formation intuitions in a lower dimensional space, helps you solve problems when you think in n-dimensional vector spacious. I hope I managed to emphasize, how important is this concept and how does it will help you build understanding vectors even in n-dimensional space. So, the key takeaway from this lesson is is that vectors are nothing more than , as a one-dimensional array of numbers. And the number of dimensions in a vector Space is nothing more than the number of the features we took into account for this vector. A larger number of signs leads to higher dimension. So when for any object you take into account more features, you get higher dimensional vectors. Now similar vectors will be closer in vector space, and different ones—further one from one. So, now that we know what it is vectors, the next big question is: how determine which vectors are similar and which are not? That's what we'll learn in this lesson. So, what are similarity metrics? A similarity metric is simply a function, which takes two vectors as input and returns a numerical estimate that reflects the degree of their similarity. This number helps us understand whether two pieces of data close to each other one, or they are far away vector space. Different metrics determine similarity in terms of different, and that's what makes the topic interesting. So just remember: everything we we will learn about the similarity metric, which is just a function that takes two vectors and returns a numerical score of their similarity . In this lecture we will focus on two the most important similarity metrics. This is cosine similarity and Euclidean similarity. distance. Let's start with cosine similarity. Cosine similarity compares vectors on based on their direction, not size. So, in essence, cosine similarity is not I wonder how big these two are vectors. She is not interested in the magnitude of these vectors. The only thing that matters is the direction of these vectors. So instead of asking what the distance between A and B, we are only interested in , whether A and B point in the same direction. If two vectors A and B point in the same direction, the angle between them will be very small, which means that A and B are co-directed. And if this angle increases, it means that they point in different directions. We will discuss all these angles in detail. For now, just know that the cosine similarity compares vectors based on direction. Here is the formula for calculating the cosine similarities. The numerator is a scalar product of two vectors. And the denominator is, in fact, the magnitudes of these two vectors. The result of cosine similarity is always is in the range from -1 to 1. This range follows directly from how the cosine function behaves. That's why we always get value cosine similarity in the range from -1 to 1. If the cosine similarity is 1, this means that the angle between two vectors is equal to zero. In simple terms, this means that both vectors, A and B, point in the same direction. Every time you you get cosine similarity, which is equal to 1, this means that the vectors identical. If the angle is 90°, the cosine is 90° is equal to zero. We get zero cosine similarity, which means that these two vectors are orthogonal, that is, they not related in any way. There is no direct connection between A and B. So when you get zero cosine similarity, which means that this orthogonal vectors. So, when the value of the cosine similarity is -1, and -1 we we get when the angle is 180 °. This means that when cosine similarity is -1, two vectors A and B directed in opposite directions. Whenever you see this value -1, it can be concluded that these two the vectors are opposite. So, the difference between orthogonal and opposite vectors is that, that for orthogonal we can assert: vectors A and B do not have no connection. Whereas, if these two vectors are directed in opposite directions, we see that between they have a certain connection, but they directed in opposite directions, that is, there are completely opposite. This is a pretty interesting concept. If the vectors opposites, they are related, but directed in opposite directions. While orthogonal vectors mean complete lack of any connection. These are some characteristics of metrics cosine similarity. Let's try to consolidate this concept on example. Let's take two vectors, A and B, and here, actually, the signs of these two vectors. Vector A is represented as 2, 0 and 1, and vector B—like 4, 0, and 2. So, the first step is to calculate the scalar product. The scalar product is calculated by multiplication of corresponding elements of two vectors with their subsequent addition. Here the dot product is 2 times 4, then 0. to 0, and eventually 1 to 2. When you multiply them and add them the results of the multiplication, you get scalar product equal to 10. This is was the first step—calculating the scalar product. And now the second step—let's try calculate the value (modulus). Size- it's essentially just the length of two vectors. When we calculate the value of A and B, we we get the following results. Next, let's try applying step one and step two in this formula. In the numerator we put the scalar product, which is equal to 10, and in the denominator—the product quantities, i.e. 2.23 multiplied by 4.47. And if we now try to divide, we we obtain cosine similarity approximately equal to one. Here is an important conclusion: although the magnitudes of these two vectors A and B are not the same. We clearly see that vector B is greater than vector A. So, even though the value is almost twice as large, i.e. vector B is almost twice as large as vector A, this value has no meaning. So you see that cosine similarity is equal to one, which means that both vectors point in the same direction. It means that these two vectors have a high similarity. Therefore, it is important to note that for cosine similarity only matters whether two vectors point in the same direction direction. The magnitude (modulus) does not actually have value when it comes to cosine similarity. And that's why it works so well for vector embeddings, because in vector embeddings content displayed in direction. It is not displayed in quantities. And exactly therefore the cosine similarity metric widely used in vector embeddings, which we will see in the next lectures. So, here are some options using cosine similarity. She widely used in search engines systems for matching requests with documents. It is used in recommendation systems for search similar content. In addition, today it is actively used in RAG- conveyors to obtain relevant context that can be applied to any which LLM. So, these are some usage examples, which depend on cosine similarity, because it is important for all of them the direction of these vectors, not their magnitude. So, this is the only thing you need remember about cosine similarity: What matters here is the direction, not the magnitude. Now let's consider the Euclidean distance. So, Euclidean distance measures the straight line distance between two vectors in spacious. Unlike cosine similarity, This metric is indifferent to direction. Instead, she is interested in how far these two vectors are located apart one in vector space and which the actual distance between A and B. This is what she is interested. Imagine you have two points, A and B. If you draw a straight line between them, This length is the Euclidean distance. So, if these two points are close, the distance will be small. And if they are further apart from each other, then the distance will be great. Now here is the formula for calculating Euclidean distance. We take the sum of all the squares of the differences, and then we take the square root. Here's how you can calculate the Euclidean distance, and that essentially gives us is the straight line distance between A and B. This is several important properties of the Euclidean distances. She has range. It is obvious that the range The distance can be from zero to infinity. So, if both vectors, A and B, are at one point, then the distance will be equal to zero. But the range can be infinite. . If it is zero, it means that both the vectors are identical. This means that both they are the same point, absolutely the same point. Only then is it possible to obtain a result that is zero. If this Euclidean distance is large, it means that the vectors are dissimilar. So, these are some important properties Euclidean distance. Now let's try to understand this in example. So, let's take two different vectors A and B. A is 3, 1, 2, and B is 6, 4, and 5. First of all, we calculate the differences. We just subtract 3-6, we get -3, 1-4 , we get -3, and 2-5, we get -3, and then we square these differences. So, we get 9 + 9 + 9, which is 27. And then to find Euclidean distance, we only need find the square root of 27, which is equal to 5.2. So this 5.2 is the Euclidean distance between vectors A and B, and this is the actual distance between these two points. This is how Euclidean distance is calculated. What are the possible uses? Euclidean distance? She is widely used in GPS systems. She used in robotics. It is used to calculate the physical distance between two vectors, and also in many spatial problems. So, as you can see, the Euclidean distance actively used in physical in a world where distance matters. For example, it is important to know the real distance between A and B. The direction in these cases is irrelevant value. So, it is then that the Euclidean distance has great importance, but in vector embeddings, since we are studying vector databases, I would say that cosine similarity is the most popular metric in such bases. Let's quickly review the key points. this lesson. So, similarity metrics compare two vectors numerically. Cosine similarity focuses on direction. It shows us whether two vectors in the same direction. In cosine similarity, only the direction, while Euclidean distance measures how far one is from these vectors are located together. Here the magnitude of these two vectors plays a role a big role, and all that matters is the actual distance between these two vectors. Choosing between cosine similarity and Euclidean distance obviously depends on depending on the specific case and context task. So, it's obvious that if you understand that such is cosine similarity and metrics Euclidean distance, then you can apply it in the appropriate context . That's why understanding this is so important. Now, all the concepts we just covered studied, actively used in semantic search. They used in recommendations systems and when creating systems artificial intelligence. Okay, that's all for now. video. On the third day we will figure out what such tokens. Thank you for watching. In this video, let's Let's find out what tokens are. So, we will look at what tokenization is. . Why do we even need tokens? And how does tokenization fit into the overall vector database pipeline. These are the key concepts we will explore in this video. So let's get started. Previously in this vector base pipeline data we understood that the embedding model is responsible for generating vector representations. So, we load these raw data, and the embedding model generates vector representations. But the thing is that these models These people don't understand embeddings at all. raw data, as it is in text format, right? Or let's say it's an audio or video format, but these embedding models still don't understand this raw data. So inside these embedding models what happens is that the raw data first turn into something that called tokens, right? And these tokens are nothing but certain numerical representation of these raw data. And then inside these tokens are converted into vector representations , right? And this is what is done inside embedding models, so you don't need to do this, right? This happens internally, but you must understand what tokens are, so that tokens are actually a modern currency, Yes? This is the currency on which you are actually There is a fee, right? All embed models charge a fee depending on the number of tokens, right? Not based on the amount of data you you download, namely based on these tokens. And that's why it's important to have a clear understanding of that , what are tokens, right? So with that motivation, let's try understand what tokens are. So tokenization is a process, right? Uh, raw data breakdown, right? on something called tokens, right? This is what tokenization really is . This is the process of breaking down raw data into tokens, right? So what happens: let's say you have there is this raw data. This can be text, audio, video, etc. whatever, right? You have these raw data. OK? They are sent as input, right? To this tokenizer. And what do you actually get, right? What you get at the output is tokens, right? And what do these tokens look like? It's really just an array of numbers, right? So you just get certain tokens, Yes? OK? So, this is tokenization. Yes? So, you have this raw data. This is the input data for the tokenizer, and on output—certain tokens, numeric expression raw data, right? This is tokenization. Okay, the first type is character-by-character tokenization, right? Then you can also tokenize based on words, right? This is called tokenization by words. Yes? And there is a third type—this is tokenization by subtitles, right? So, these are the three types of tokenization that you will collide, right? So what is character tokenization? Let's try to figure out these three. types on the example, right? Let's say I have the text "I love vector databases", right? Let's say this is our line, right? So, in case...sorry, in case character-by-character tokenization occurs here's the thing: every character, right? Each character actually turns into certain tokens, right? So how many characters are there—about 13 unique characters. If you just Try checking this, okay? There will be 13 unique characters, right? So, using character-by-character tokenizer, you will receive 13 tokens, Yes? Using this character-by-character tokenizer, right? You will get about 13 tokens, right? The problem with character-by-character tokenization is that that the number of tokens will be huge, Yes? And this is not an optimal solution, because imagine just for this short sentence , right? You would have 13 tokens, right? After all, if you consider, you know, some huge sentence, right? And all the combinations, all the different types characters, then the number of tokens will be huge. So the bottom line is that the main drawback of the character tokenizer—this is the growth number of tokens, right? That's the main problem, right? A character tokenizer, right? Now, if we consider the tokenizer as In other words, how many tokens will you get? So if you look at it now, let's say , tokenizer by words, right? How many tokens will you get from this, Yes? There would be about five tokens here, right? ? Why five tokens? It's four words, four separate words, and There are still spaces, right? So you'll get five tokens here, Yes? But even a verbatim tokenizer is not optimal, because if you look at English dictionary, right? You'll actually get, you know, there so many words in the dictionary English language. Now you will have the same number tokens. This, this is good, but there are certain words, for example, if we take the word " tokenization, right? You will see that this word consists of two parts, actually: "token" and " "ization", right? And there are many words in the English language that end like this, right? So, "token" is a word, we know that. , and there are many words ending in " "ization", right? So, if we now consider the subjunctive tokenizer, right? Yes. If you consider the subjunctive tokenizer, it optimally splits words into smaller parts to reduce, You know, the number of tokens, right? We could use the proverb tokenizer, but the problem with it was in that every word would be perceived as unique, so the "token" would be separate in a word, and "tokenization" would be separate in a word, right? Whereas in English we know that words can be broken down into smaller parts, and that's why all modern, you know, tokenizers that are in ChatGPT or any which large language models, use the concept of subtext tokenization, and I'll explain it now in two examples to clarify the situation, right? I hope you understand what these three are. types of tokenization. First, we have character-based tokenization symbols. Then we have a proverb tokenization based on quantity words, right? And then you have sub-word tokenization, which optimally breaks up words, right? This is something that is done not just by chance, Yes? This is actually done using a lot of, you know, training to find the optimal way to reduce number of tokens, right? And when I show these examples, this the concept will become quite clear. Good , and now let's move on to the tokenizer on OpenAI platform. And let's start with this example, which they They have it here, right? So, if you look for this example, right? So, you see that this sentence, this, uh, paragraph, right? What you have here, it turns into 53 tokens. And here it says that many words are displayed in one token, but some— no, right? For example, if you look here, " "indivisible", right? This word actually breaks into two tokens, right? But if you look at these initial words: "many", "then", "words", "map", " to", "one", "token", —they are all are displayed in one token, right? Now , further here it is said that Unicode characters, such as emojis, can be broken down into a lot of tokens, right? Which contain basic byte. For example, this emoji, right? What you have here, it turns into four tokens. And it also says here that the sequence symbols that often appear next to each other , can be grouped together. For example, 1 2 3 becomes one token, 4 5 6 becomes one token and 7 8 9 becomes another token, right? So, and if you want to see these token IDs, you you can see, you know, these token identifiers as well. So, it is very important to understand the concept, that many words are displayed in one token. But some words appear in several tokens, then Unicode characters are displayed on a byte basis, and we seen that sometimes a lot, you know, common character sequences can be grouped together into one token, so ? And all this is done based on optimization to minimize the number of tokens. So you can see that if this were character-by-character tokenizer, right? 252 symbols, right? Uh, that would be 252 tokens, right? Whereas you only have 53 characters here. Okay, let me try. explain this with a few examples, okay? So if you now look at these words, right? For example, "organization" gets one token, "optimization" receives one token. But there are a few words, such as "standardization", "globalization" ", right? They break into two tokens, right? For example, "global" is one token, and " "ization". And there are many words that end in " ization", and this is where you can see that we can use the same the token "ization" for all these words, and this the concept of subword tokenization, where words broken down to optimize quantity tokens. And if you want to see these token identifiers, you can simply switch to the "token IDs" tab, Yes? So, this is the main concept that you should understand about tokenization, right? Yes? And subjunctive tokenizers are what used by all major modern languages models for optimizing the number of tokens . So, that's the key takeaway from this. video. I hope you enjoyed this. video. See you next time. Greetings everyone, welcome back. Today the fourth day of our series "Vector databases: from zero to hero. In this video we will understand what models are embeddings and why they are so important. We will also explore the power of vector mathematics in embeddings using visualizations. Then we will look at different types of models embeddings that exist today. AND Finally, we will consider some popular embedding models that used in productive systems today, right? So by the end of this lecture you will have a clear understanding of embeddings. So, without wasting any time, let's dive in. In the last lecture we talked about tokens . And we've broken down some important concepts regarding tokens. So, tokens are nothing else , like converting raw text into numerical representation. And we convert raw text into numerical representation because models embeddings do not understand the text. They only understand numbers. But the main thing you should remember is that these numbers are just a numerical representation raw data. These numbers do not carry any semantic meaning. value. These are just some symbols. This is not the meaning of the raw text. But when it comes to vector bases data, they are completely dedicated semantic search. So a very important question arises here. If tokens are just numeric raw data presentation that has no meaning, then where does it come from? value? This is exactly the problem that models solve. embeddings. Let's now try to understand exactly how Embedding models solve this problem . So, first the raw data are tokenized and transformed into a certain numerical representation. These tokens are then served as input. for the embedding model. The embedding model then takes these tokens and converts them into vector embeddings. And it is these vector embeddings that capture semantic meaning. And, as you understand, these are just vectors in vector space. Let us assume that this vector space has about 1000 measurements. Then this embedding model will generate vector embeddings with 1000 dimensions. So this array will have about 1000 numbers. And these numbers are nothing more than coordinates in vector space. That's what vector embedding is. These are simply certain coordinates in vector space. space based on measurements. So, the main idea here is very simple. So objects or text with similar meaning will be closer to each other in vector space. Whereas objects with different meanings will be further apart in vector spacious. Since these embeddings are just vectors, we can perform certain vector operations calculations over them. So to demonstrate this, let me show you interesting examples from visualizations. So now I'm in this vector field, and the model I use is Glove 300D. Since these embeddings are simply mathematical vectors, we can perform mathematical operations with them. For example, suppose I execute the following vector calculation: king minus man plus woman, and if you calculate, you You will see the queen coming out. Although we have never trained this model, the connections between these words are calculated on based on vector calculations. And that is very powerful. Let's take a look another example. Let's say we do Delhi minus India plus Japan. And if you try to calculate it, it turns out Tokyo. So, Delhi is the capital of India, and Tokyo is the capital of Japan. These vector-based calculations are very interesting because everything we needed was to do is to convert words into vectors embeddings in this space, and then perform a vector calculation, which is the concept of semantic search. Because when all words turn into vector embeddings in vector spacious, words with similar meaning are closer to each other, and words with different meanings—one more than one. This is the basis on which we perform vector calculations, and this is fundamental the concept that powers your vector bases data. So you can search similarities based on these vector calculations. In summary: embeddings are simple coordinates in vector space. Here we display these words in three-dimensional vector space, but when working with real models embeddings spaces have more measurements, and the latest models generate embeddings with almost 3000 dimensions. That is why vector databases are widely used for construction semantic search in modern applications . Now let's look at the types of models embeddings that exist. The first type we have is where it all began. from word embeddings. The first type is word embedding models. . So, this vector representation model words takes a word as input for embedding models. So she takes the floor at the entrance, and at the output only produces embeddings, certain numbers with floating point. Of course? Here's what these vector ones do representation of words. Now, a few popular examples vector representation models of words— this is word2vec. And another example that comes to mind , this is GloVe. So, these are two popular vector models representation of the words we have. But the problem with vector representations of words is that , let's say you're trying to create embedding for the word "river". And there is another word, say, "bank." And there's another word, let's say "account". Of course? So, in vector representations of words Embeddings are generated for individual words. The thing is that the main limitation is in that you have a sentence, say, " river". Suppose you have the sentence "river shore". And you have another sentence, " bank account". Now, since these embeddings are generated for individual words, we won't know what actually means "bank" in this sentence . So the main disadvantage of vector the representation of words is that in They lack context. So, this is the main limitation of the models vector representation of words, but precisely That's how we started. We once developed word2vec models and GloVe, which are powerful if you want search for individual words, but they not as effective when you try find the context of a word in a particular sentence . And this is the main limitation of the vector model representation of words. So, this is the first embedding model that There are us. Now, the second type of model that we have , these are vector representation models text. This is the second type of embedding model that we we have. Now, in this case, how could you guess these vector models text representation is accepted as input sentences or, you know, even paragraphs or entire documents. And they turn these sentences, paragraphs or entire documents into vector embeddings . So, the main advantage of this type models is that we can convert an entire sentence into vectors, paragraph or document, and based on that embeddings are generated, which allows compare two sentences with each other. You can compare two paragraphs. You you can even compare the entire document, you know, with a search query. So, this is the main strength of text-based embeddings. And today there are many models text embeddings, for example, from OpenAI. They are from Gemini. And almost every supplier has some text embedding models. Because it is a kind of foundation on which which large language models are built. So yes. So, this is what they are text embedding models. And they are actively used in semantic search. They are widely used in creating RAG systems and recommendations movers. So, this is a text model embeddings. And the third type that we have, and it's very popular today—it's multimodal embeddings. Yes. This is the third type of embedding model, multimodal embedding. So what do these multimodal embeddings: here, along with sentences, paragraphs and entire documents, you can also you can create embeds for images. So you can also send image. So, essentially, these multimodal embeddings support text and images. And this turns into on vector embeddings. So, these are the three popular types of models embeddings you will encounter. Nobody uses idioms now. embeddings, because this was just the beginning modeling embeddings. But this led to several more studies . And the result was the creation of models text embeddings and multimedia embeddings. But today you will mostly be use text and image models multimodal embeddings in your vector database pipelines for building semantic search. So, if you're, say, building something that based solely on text, no sense to use multimodal embeddings. You can simply implement this use case using text embeddings. On the other hand, if you want to support RAG conveyor or document search, for example, in a PDF file that contains as text and images, then you, of course, choose multimodal embeddings. So, this is the main strength multimodal embeddings. So this, by the way essentially, three types of embedding models, with which you will meet. Okay, now here are some popular embedding models that you should know about if you are building semantic search and RAG pipelines with using vector databases. Do you have text embedding models from OpenAI. Do you have models from Google Gemini? Embedding One. Then there are other embedding models from Cohere, as well as Microsoft CodeBERT, optimized for code understanding. And recently Google released Gemini Embedding Two, which is a model multimodal embeddings. And here you are you can see the whole list dimensions they support. AND Here are the usage options. Mostly you can see that these options uses relate to the creation of RAG and semantic search. CodeBERT used, you know, for searching code similarity and code search. Whereas this is Gemini embedding two, which is multimodal embedding model. And it supports both search by both images and text. Now not it is worth thinking that these are the only ones available embedding models. There are many more, but I just wanted to highlight a few popular ones here embedding models at the moment. So, the key takeaway from this video is is that tokenization is simply converts raw text into numerical representation, which is then is sent to the embedding model, which generates vector embeddings so you can could search by similarity and create RAG conveyors and systems recommendations. So, that's all in this video. I hope so. this video was helpful, and see you in next. Thank you for watching. Greetings everyone, welcome back. Today fifth day of the series "Vector databases: from zero to hero", and finally the time has come for a live demonstration. In this video we Let's explore some embedding models from Google Gemini and then we'll see it live demonstration where we will generate vector embeddings using a model Gemini embedding. So, without wasting any time, Let's dive in. Okay, now let's explore some embedding models from Gemini. So, I'm on the API documentation page Gemini. Now if you just go to these versions of models currently available from Gemini, these are embedding models. First, we have Gemini embeddings. Codename for the Gemini embedding model —Gemini embedding 001. It supports text as input, and at the output we get text embeddings. The limit of input tokens is 2048, and Output dimensions are flexible. It supports any value from 128 up to 3072 dimensions. So you can enter any value in within this range, but recommended The dimensions are 768, 1536, and 3072. And the last update of this model was in June 2025. So, this is a text embedding model. from Gemini. Now there is another model embeddings—this is the Gemini embedding model two. It was released in April 2026, very recently. The code name is Gemini embedding two. And the most interesting thing is that it supports how you can see, text, images, video, audio and even PDF as input data . And at the output we again get embeddings, i.e. text embeddings. Now the input size limit is here much higher. Obviously it supports PDF, so you you can imagine that the limit of incoming tokens much larger. About 8192 tokens, and the output the dimension is again flexible, its can be customized, and it supports range from 1 to 3072. These are the recommended dimensions that you you can generate. So, this is a general overview of these two embedding models from Gemini. In our demo we will use this Gemini embedding model, and in in future lectures we will also explore Gemini Embedding 2 and possibly demonstrate some multimodal embeddings, but in this lecture we we will focus mainly on the Gemini model embedding. Okay, now let's move on to Google Colab . This notebook demonstrates the creation of vector embeddings using the model Gemini embedding 001. The first step is to import all the necessary packages. We need google.generativeai. We also need pandas, and we need to import cosine_similarity with sklearn. These are some important packages that you need import. Next we try to get the API key from Google Collaborate. I set up this API key here, so you you can see in the "secrets" section that I have a Google API key set up. So make sure you generate Google API key to access the model embedding. Now that the API key is available, you you can generate a Generative AI client using this key. Here's how to do it. Then, in the next step, I have list of texts. I have an array of sentences here. And what I'm trying to do is simply pass this list of texts as incoming data for the embedding model. So, I use client.models.embed_content. Do you remember? , in the previous step we created this Generative AI client. So, with the help of this client you can start create embeds for your documents. You need to pass the model name here that you want to use, the content and some additional configurations. This is what you can define here. Here is an example from the documentation. As you can see, I specified the model name as Gemini Embedding 001. The content is simply the array of text that is in I have it, and then a certain configuration. In the configuration file I specify what I want, so that the output dimension is 768, and the type The task is semantic similarity. Here's how you can generate these embeds . After we get the result from this API, we just pass loop over this result and output these embeddings. So, let's try to run it now. Therefore , let's try to run it first. We import the necessary packages. Then let's run this set of API keys. And then there's a very interesting step here. Now we'll try to generate embeddings, so let's try to run it. If you look here, you will see that for all these examples we were able to create an embedding. You might say, "How do I write function in Python?" For this, the length embedding was 768. 768 is what we have determined, therefore the whole weekend the result will have the following dimension: 768. And you see that for each text you have there are these embeddings. So if you see that this array has length 768, this is because 768 is generated embeddings, since it is a vector space of 768 dimensions. So all these examples have dimension 768, okay? Now, from these embeddings, not quite it is clear which sentences are similar to each other one, and which ones are not. To do this, I did the following: we using pandas and cosine similarity to try to generate similarity matrix. If you now look at the matrix similarities, you will find something very interesting. For example, if you take this example : "How do I write a function in Python?" It has the highest similarity to the phrase "How Should I write a class in Java? Then if you look at another example, for example: "What smartphone has "the best camera?" Obviously, you see that the biggest similarity to the question "What is the best Android phone?" So, these two have the highest similarity. Now let's take another example. Let's say: " "Turn off the light." This has the highest similarity to the phrase "Ghasy light". Wow, this is really interesting stuff. Using vector embeddings, we we can find similar ones in this list sentence. You can understand the power of these vector embeddings because we can perform search by similarity. Now let's translate these similarity metrics to another level. Let's try to visualize this. If we need to visualize this in 3D space , we can do this using PCA . What is PCA? PCA stands for method Principal Component Analysis). So what does it do: in short, PCA reduces the number of dimensions in the data, while preserving as much as possible important information. You can imagine that these vector The embeddings have 768 dimensions. So, as humans, we cannot visualize something in 768 dimensions, and that's This is where the PCA concept comes to the rescue. . So it reduces 768 dimensions to three, so we can visualize this in three-dimensional space. So, here is the code we use to we can create this visualization. I will not go into detail about this now. code, as this is out of scope this video, but if I just run him, you will see that we can visualize these sentence embeddings in three-dimensional space. Of course? This is obviously static image. There is another way to do this. more dynamic. You can do this. using plotly. So if I just I'll run this, okay? And that's a lot more interactive. So you see here that, for example, these two sentences: "How do I create a class in Java?" and "How do I write a function in Python?" You you see that they are closely related. Next you see the following example here. "Which Android phone is the best?" and " Which smartphone has the best camera? They are, you know, similar again, and that's why the distance between them is very small. Here's how you can visualize these embeddings and see which sentences are similar , and which ones are not. This is a really powerful concept, and I I encourage you to experiment with this. notebook. You can go here and change the sentence. That's all you need. do, just play around with it and see what result you get . So, that's all I wanted to cover in this video about how we can generate embeddings using a model Gemini. I hope this video was for you are useful. See you next time. Thank you for watching. Hello everyone, please. please come back. Today is the sixth day. our series "Vector Databases: From zero to pro". In this video we Let's explore the key components of vector databases, and we will also see how these components work together to make search by similarity extremely fast and scalable. So at the end of this lecture you will have a clear understanding of how a vector basis data efficiently stores, indexes and extracts multidimensional vector embeddings . So, without wasting any time, let's Let's delve into the topic. Now let's learn high-level vector database design. Previously we studied the high-level pipeline vector database. Now let's try to understand how what does the internal architecture of a vector look like databases. We will understand how a vector database actually stores vectors as it is indexes and how these vectors are extracted from her. Here are the key components you you will find in the vector database. So, first, we have an API gateway. Then there is the indexation level, the level request processing, as well as the level storage. These are the internal components you will find in each vector database. Entry point to a vector database there is always an API gateway. The API gateway's responsibility is to it is he who interacts with the vector base data. The API gateway is responsible for providing interfaces so that the client application can store, update, read or delete vectors. To perform all these operations, the API- The gateway provides the appropriate APIs for the client to could perform these actions. This is the main responsibility of the API gateway. It also provides an API for execution queries to these vectors. It is worth noting that these operations are different from vector queries, because you perform them at the stage data entry while storing, while the query operation occurs during search. These are two different operations that any -what client application, and duty API gateway—provide these interfaces to the client. This is the responsibility of the API gateway. Next we have the indexation level. The goal of this level is to order the vectors for efficient similarity search. And this is nothing new. You will encounter the indexation level in any any database, be it traditional SQL or NoSQL. They have this level indexation. Similarly, in a vector database you You will also encounter the indexation level. The main purpose of the indexation level is— efficient similarity search and avoidance a rough search. Therefore, for indexing, most vector databases use two methods. One of them is IVF. IVF stands for inverted file index (inverted file index). Of course? This is a method that most vector databases use. data is used for indexing. There is another popular method indexing—HNSW, which stands for hierarchical navigational small worlds (hierarchical navigable small worlds). These are the two key methods that most vector databases are used for indexation levels. As I said, the main task of the level indexing—to provide fast searching, or wrong? Low latency search so you can efficiently search millions of vectors in this level of storage. This is the destination this level of indexation. Next we have the storage level. So, the storage level is designed for effective storage of these multidimensional vectors. The main feature of any level storage is fast addition, fast retrieval and quick deletion. These operations must be extremely fast. The storage level also provides high durability and reliability. How it provides high durability and reliability? Thanks to replication. So this level can be replicated for ensuring fault tolerance. And you can also perform partitioning if you want to scale. Therefore, you need to do partitioning. It all the fundamental methods that you you will find in any database. These methods are also available in any vector database you want use for industrial solutions. This is the responsibility of the storage level. And there is another level—this is the processing level. requests. This layer processes any vector requests. So every time the client the program is looking for a vector query, this one the request processing layer ensures that the incoming request will be processed efficiently . So, the duty of this level of processing queries is the processing of these incoming search queries requests. This level coordinates work with the level indexing and storage level. This is where he uses methods filtering and ranking results after they are received. This is the responsibility of the request processing layer. In summary, these are the key components that you will find in any vector database data. So you have an API gateway that is entry point. Then there is the indexation level. , which ensures that whatever you are looking for, will always be fast and efficient. Further storage level is intended for ensuring the stability of your data. And then there is the request processing level, which always ensures that the query vectors are compared with everything stored on storage levels. So, these are the four key components that you will find in any vector database data. I hope this video was for you. useful. See you next time. Thank you for viewing. Hello everyone, kind regards please come back. Finally, the moment has come, which we have all been waiting for. In this demonstration we will generate embeddings and store them in Chroma DB. Then we will perform some semantic search queries using Chroma DB . So, without wasting time, let's begin. So, it's time for a live demonstration . In this demonstration, we will store and query vector representations by using Chroma DB. So, the first step is to import the necessary packages. We need Google's GenAI package for creating a GenAI client. And all we need to do here is convey API key that I have in my secrets. In the secrets section you will see that in I have this API key stored there . Therefore, you will need to generate this API key before creating a client GenAI by Gemini. So let's try importing these packages, and then install the API key. And then, the third step—we need generate vector representations by using the Gemini embedding model. This is exactly the same example that we saw in the previous lecture where we generated vector representations by using the Gemini embedding model. So here I have a list of text that I I am passing this content inside because I want to generate vector representation for this entire text. And for this you just need call client.models. embed content. What supports embed content is The arguments you must pass are: the model you want to use to generate these vector representations . You need to transfer the content, and you also you can pass additional configuration. So here, in this configuration, we we pass the dimension of the output, which is equal to 768. You can transfer up to 3072 measurements, but the optimal dimensions are 768, 1536 or 3072. These are the optimal dimensions that you can use. Here, for this example, I use 768 as dimension. So, this is where this model will be called embeddings and generated vector representation. And here we just iterate through these generated vector representations and we display them here. So, if we just let's try to run these steps, then this It's done now. If you see here, we now have vector representations that are generated for all texts in this list. So, this is the first step. We have completed the generation of vector representations using a model Gemini embeddings. Now the next step—we want to save these vector representations inside Chroma DB. So for this you will need install Chroma DB. So, for this you you can use pip install Chroma DB . If you just click on it, it will try to install all these packages on our car. So, yes, it's done. If you do This is your first time, it may take you a while. more time. So, it's done. Now in the next step we can save these vector representations in Chroma DB. So, for this, the first thing we need to do is you need to create a Chroma DB client. To do this, you can simply use Chroma DB.client, here are these imports. Make sure you add these imports after installing the Chroma DB package. So, using Chroma DB.client, you can get the Chroma DB client, and here I am I specify the directory to save where I I want to, you know, store data on my computer. This is how the Chroma DB client is created. The next step is to create a collection. What What is this collection? A collection is like a table in database. Just like we have tables in SQL databases, there are collections in NoSQL databases. Similarly, you can create collection. To do this, you can use the get or method. create collection. So, if such a collection does not exist, it will create a new one. Here I define the name collections—Chroma DB demo. This is where I want to store these vector images. representation. So, this is the collection. Now that the collection is created, before add vector representations to it, which we generated. So, if you remember, we generated vector representations in this variable result. As you can see, here we have all these vector representation inside result. We just extract these representations and we store them in the embeddings array. This is how we can get these representation. And in the documents section we assign all these texts. Is this text defined? Text is where we defined the entire list of texts. We do the following: together with vector representations for each text we we also save the text itself. So, you have the documents, and also presentation for these documents. Additionally, we assign IDs to these records within the collection. So if you run it now, yes. As you can see, the submission was successful. saved. So, we have completed the storage representations in Chroma DB. Now the most interesting thing. How are we now? query these vector representations in Chroma DB? Here I have a request. This is a request. Therefore, what will I do here: for queries you are now you can use client.models.embeddings. This, you know, is an important step. We've already considered this in our pipeline. vector database: before to make any request, you need create a vector representation of the query. So, you need to create a vector request representation using that the model itself and the dimension. If you don't use the same model, for example , for all our original text to store these vectors we used Gemini embedding 001. Now you can't use another one model for vector representations. It must be the same model. And also, it has be the same dimension. If you just use another dimension for its vector submitting a request, this will not work, since the query vector and the vectors that stored in a vector database, must match. That's why this step is so important. Therefore, how we create a vector representation query: we use that one again the client himself. This is a client from GenAI, Google GenAI. Using this client, models.embed_content where needed pass the model name and the content itself. Here, the content is your request. You can also transfer the configuration. The default dimension is 3072. Ago make sure you always specify this dimension. So, when you do this, you will get a vector representation request. And then this vector representation can be used to query your ChromaDB collection. This is yours. ChromaDB collection where you can call collection.query. And to you you need to pass a vector representation request. Here we indicate how many results we expect to receive from this collection on based on the request. If we try to run this, then my the query will be "programming". If I I'll try to run this, you'll see something. very interesting. We get these two texts as a result. How do I write a function? in Python? And how do you create a class in Java? These are the texts that we originally stored in vector database. So, if you see, when searching for the word "programming" means two texts, that match the request. It is interesting that nowhere in these two texts there is no word "programming". This keyword is missing from these texts , but the system was still able to find texts related to programming, and in This is the power of semantic search. This is something you cannot achieve by using a regular keyword search words, because with such a search you would not received these two texts. Now let's look at another example. Let's say I'm looking here for, let's say, electronics. Now, if you just type " electronics,” that’s what we’ll get. Apple has released a new iPhone. Which Which smartphone has the best camera? These two texts are about electronics, and This is precisely the power of semantics. search. That's why vector databases are so powerful. This is what keeps your recommendation systems. That is why all popular Internet stores today use vector databases and vector search for semantic search and system operation recommendations. I hope this video was interesting. Thank you thanks for watching, see you next time.

Generated algorithmically for Search Engine Indexing.

Summarize Another Video