From the course: Hands-On AI: Build a RAG Model from Scratch with Open Source

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Retrieving content from your database

Retrieving content from your database

- [Instructor] Welcome back. Let's conclude this chapter on database processes by covering how we'll retrieve data from our database. To retrieve data, we run what's called a vector search. This requires that we have a query vector and given a database of vectors which we've just created, we wanna find the database vector most similar to the query vector in this high dimensional space that these vectors live in. There are a few ways to measure similarity, but one of the simplest ways is simply to take the co-sign distance, which is a measure proportional to the angle between the two vectors. And this can be done in a space with an arbitrarily high number of dimensions. Now remember that each value of the vector stores a certain concept about the idea which the vector represents. So we're measuring the angle between all these different concepts simultaneously and boiling it down to one number. If the angle is smaller…

Contents