Okay, so now we have our big document divided in small chunks with the splitters.
We have transform the chunks of text into numbers into embeddings.
And now we want to store these numbers, these embeddings into our vector database also called vector
store okay.
So remember that what we are doing is store embeddings in a very fast searchable database.
That is the this is the magic of the vector database is that they can search and manage number in a
super fast way.
Okay.
So in the notebook you have the traditional intro with the setup.
ET cetera, et cetera.
And then you have the steps of the rack process, you know, uh, and you have the previous examples.
Okay.
So now we have a the A section where we are starting to talk about vector databases.
The first thing to understand about vector databases is that we have many different alternatives.
In the world of vector databases we can use chroma phase pinecone database.
We have a large number of databases out there.
And if you click here in this link you will see all the different databases you can use.
Okay.
It is like in the software development world where you can use a very large number of databases, right.
So in some cases some of the students ask us, hey, why don't you use this, this type of database
or this brand of database or you know, eh, whatever.
Right.
And we always say the same, we have selected a number of different databases a we consider more simple
in the case of the beginners exercises, or more frequently used in the community of generative AI engineers.
Okay, the important thing, as always for you, is to understand the concept and understand the basic
examples and the more advanced examples you are going to see in the project.
Once you have done it, then you can go to the documentation, to the launching documentation about
any other database you want to use.
Okay, so don't worry about that.
We are going to see the basics and then we are going to see more advanced examples.
And here you have a link where you can see all the different databases that are today integrated with
launching.
So in this initial example we are going to use the vector database chroma okay.
Very simple very easy a database to use.
So the first thing we are going to do is we are going to load our document.
Our document in this case is going to be the a state of the Union, a intervention, the, you know,
the the speech of the president in the state of the Union.
Okay.
So this is a very traditionally used document in the long chain.
Documentation is very boring, but it's very frequently used.
Okay.
So the first thing we do is we load the document.
Then we divide the document in small chunks with a splitter.
We are using a very simple splitter here.
And then we are loading the embeddings.
We are in one step.
Okay.
So see here in one step.
Let me make this.
Okay.
So in one step we are transforming the chunks of text into embeddings and loading the embeddings into
the chroma database.
Okay.
So now in this new variable called vector database, we can call it whatever we want but we call it
vector db.
So in this variable now we have the vector database.
Okay.
So as you can see we could use this vector database to answer questions from the users.
As you are going to see in the next lesson.
This is not going to be the main way we are going to use in our RAC applications, but it's one way
you can use.
So it can be used right?
It's not the most frequently used, but it's one way you can use.
So in this case we are using the function dot similarity search in order to find an answer to the question
of the user.
So what is the question of the user.
So the user right now is asking okay in this text that you have in this document a the president of
the United States is talking about many things.
The state of the Union address.
Right.
But we only want to know what the president said about the judge or about this thing, the John Lewis
Voting Rights Act.
Okay.
So what did the president say about that?
So what we are doing here is we are taking this question.
We are converting the question into an embedding.
We are taking this question as a as an embedding to the vector database.
And we are a searching for similar embeddings in the vector database in order to find a response.
So what are we finding?
How is this similarity search function working.
So this similarity search function is giving us the part in the state of the Union address of the president,
where the president is talking about the John Lewis Voting Rights Act.
Okay.
So what it is doing is not a response.
The perfect response.
We are looking so because probably if anyone asks you this question and you know about the this state
of the Union address, you are not going to give him, you know, give the user just the three paragraphs
where this is mentioned.
You will redact your answer and you will say, the president of the United States, in the address of
the state union said this about this Rights Act, blah, blah, blah.
Okay, so as you can see here, this response is not perfectly formatted, but it is starting to to
to look interesting.
Right?
So here you have an explanation step by step of what this similarity search function is doing.
Okay.
So basically a you you could think of this map explanation I gave you.
Right.
So this similarity search is saying, okay, I'm going to take the question of the user, and I'm going
to transform this question into coordinates in the map.
Okay.
So I have my map.
Now I'm going to convert this question into numbers.
And these numbers are going to be like coordinates in the map.
And once I have this question as a point in the map, I'm going to look for other points closer to this,
to this question.
Right.
And the closer the closest point is going to be the answer.
Okay.
So just from a conceptual point of view, I'm trying to tell you how this vector database works, because
at the end of the day, vectors are just positions in the space okay.
So here you have an explanation of what the similarity search method or function is doing.
Method and function are synonymous here.
Okay.
And finally, you have here how to execute the code in the code editor.
Okay.
And here you have in line 15.
This is not an executable executable line.
This is just a comment.
Okay.
So this is an invisible line.
But we don't want you to remove this line.
If you remove this line, you are going to have an error message.
Okay.
So this is just a comment.
This is not an executive executable line.
The executable line is this one.
33.
If you if you enter here the pound sign this is not going to be executed.
And if you remove the pound sign it will be executed.
Okay.
So here you have the instructions about how to execute the code in the code editor.
Just go to the root directory of the project and execute this line in your terminal.
Okay.
So let's continue with more advances in the rack process.