In this video, I'm going to show you how you can use AI to search through large data sets and find the best matching records using vector search. So, let me give you an example. In front of me, I have a spreadsheet which has over a,000 records of property listings in London.
And what I'm going to do is I'm going to ask it to recommend properties to me based on my defined criterias. Okay. So, I've told it that I'm looking for a penthouse on William Street.
It must have at least five bedrooms and a lakeside view. My budget is about this. Don't pay attention to the budget and all.
It's not real market data. So, just ignore that. Okay.
So, now I'm going to send it through and it's going to look through the spreadsheet and it's going to find the best matching records based on the criterias we have defined. Okay. So, as you can see, it has completed the vector search and here's the property.
So property title five bedroomedroom penthouse address one William Street description blah blah blah price is this much that's about in this range and then this is the size this is uh the number of bedrooms bathrooms lease hole and service charge okay so it recommended a property that perfectly matches the description now let's go back to the Google sheet and see whether or not this information is correct okay so I searched the spreadsheet based on pricing and it seems that this is the property it had recommended. So a 5-bedroom penthouse for sale in one William Street and then this is the description which matches what it had told us there and here's the service charge as well and it's a penthouse. Then this is we have five bedrooms, five bathrooms and the size is 4944 square ft which is right.
So that means the search was accurate. So before we begin, let me tell you that there's this big misconception when it comes to data and AI. People think that when there is a large data set that has to be processed um using artificial intelligence, they have to spend a lot of money.
They need to do a lot of coding and need a complex setup. But that's not the reality. There's no need for you to fine-tune a model um to query large data sets.
You can easily achieve the same results using vector stores. So for the purpose of this video, we're going to use NA10 as the no code automation platform wherein we're going to build this from scratch. This automation is going to upload files to your vector store.
Whereas this automation is going to query the data. And for the vector store capability, we're going to use superbase. So if you're ready, let's get started.
Before that, a quick introduction about myself. My name is Yashika Jen. I'm the founder of Automates AI.
Automates AI is my AI automation agency wherein we create AI systems for businesses. Apart from that, I'm also an AI consultant consulting businesses on how they can adopt AI into their business. Previously, I had put up a video on how you can give knowledge base to your AI agents.
That was particularly if you had smaller data sets. For example, you had 10 PDFs. So, you just upload it there and AI is going to answer questions based on your files.
But what if you have a large spreadsheet with over a thousand records? In that case, you have to set up a vector store setup. In case somebody is interested in that video, I'm going to link it somewhere above here so that you can give it a watch.
Okay. So, coming back. If you already have an account with any then great, just log in.
If you don't, then there's the link to this platform in the description box below. Click on it, create an account. You're going to get a free trial.
Once you have created the account, you will come to the overview page and then you will click on the create workflow button to create or start a new automation. So the way I have designed this system is I want to upload the files only to Google Drve and then from then on the automation should take care of all the vector store stuff and the embedding stuff. I don't want to go into the technical part every time.
So all we're going to do is we're going to create an automation that takes in files from Google Drve and uploads it directly to our vector store. So to get started, you will click on this plus icon and you're going to search for Google Drve and then under triggers, you're going to select on changes involving a specific folder. After that, connect to your Google Drve account and then select the folder to which you would want to upload the files.
Okay, so I've selected my folder. It's named knowledgebased files and we're going to watch for file created. Okay.
So before moving forward we will have to test this to ensure it's working well. And to do that you will go back to your Google Drve folder and therein you will have to upload your data set. So for instance if you're using a spreadsheet you will download it as a CSV first and then you will upload it right here.
By the way, if someone is just doing this for learning purposes, then I would include the link to this particular data set so that you can download and learn how to do it in case you don't have a data set at the moment. Okay. So whether you have downloaded that and uploaded it or if you have used your own data set, you can come back here then click on this button and it's going to pick up your file that means that the connection is working all fine.
Okay. So after this we will have to go with another module of Google drive itself which is download a file module. So in order to use this file within the automation we will have to download it.
So all you have to do is select by ID here and then look for ID here. You will find it. If not you can search it and once you find it just drag and drop it right here.
That would autopop populate the file ID each and every time so that it can download it. Just to be on the safer side, click on test step. And if you see something like this as the output, then that means your file has been downloaded and the automation can access it moving forward.
Okay. So let's come out of this and save the automation. Also, if you want, you can rename the automation.
Okay. So after the file has been downloaded, we will have to extract the content of the file or basically the CSV. So we going to search for extract here and then we will select extract from CSV.
If you're using some other format, you would go with that. But I'm going to go with extract from CSV. After that, just ensure that this name matches this name data and then click on test step.
Most people won't see this error, but if you are, then you will have to click on add option and then exclude byte order mark and just turn it on and then click on test step again. Great. So, as you can see, it has retrieved all the records.
So we have almost 1,019 records um in the CSV and it has retrieved all of them. Okay. Now the next step from here is very important.
What most people would do is that they will take this extracted data and they will upload it directly to the vector store which is completely wrong. The reason being is that we're dealing with spreadsheets and if you upload it directly it's going to chunk the data and then your rows will get broken. So by that I mean that this one record would not be stored as one record.
It would get broken and when you search it back and retrieve the results, sometimes the price would be missing. Sometimes the number of bedrooms would be missing. Sometimes the description would be missing and there would be a mismatch.
And to avoid that mismatch it is very important that every single row is treated as a string and added to the vector store without being chunked. And to do that, we will have to add a simple piece of code. So just go with code here and remove this code and paste this piece of code.
You will find this code in the description below. Just look for the resources. It would be free to access.
So let me show you what it does. On the inputs pane, you can see that we have title, description, property type, everything segregated. And if I click on test step, you will see that for every single row, it provides us with a combined row field which includes the description, the price and everything all in one.
So that when we upload it to the vector store, it does not get lost or it goes here and there. So yeah, just find the um code in the description, you'll get it and after that we can directly upload it to the vector store. So let's go ahead and set up the Superbase account.
Okay. So, go to superbase. com.
I will put the link to it in the description. After that, click on start your project. Then, if you have an account, you can sign in.
If you don't have an account, you can sign up. I will just create one from scratch to show you how the process looks like. Okay.
So, it asked me to verify my email. I've done that. And now, we have to create a new organization.
So, just give your organization a name. And the type is going to be personal. And for the plan, we're just going to start with a free one.
and later on upgrade based on usage and then let's click on create organization. Okay. So now it's going to ask you to put a database password.
So just put that and store it somewhere. Then select the region which is the closest to you and then click on create new project. Great.
So the account setup is done. Now we will connect it back to NA10. So we're going to go here and we're going to search for Superbase and then select Superbase vector store.
Now since we want to upload files to the vector store, we are going to select add documents to vector store. Then it will ask you to connect your account. So click on create new credential.
Go back to superbase and then go to project settings and then go to data API. The first thing you're going to do is copy this URL. Then paste it here.
Come back. Copy the service role. This one first.
You will click on reveal and then copy and then paste it back there. Once you have pasted it, just click on save. And if you are seeing connection tested successfully, then that means it's working.
Now we'll have to create a table in Superbase. Again, quite simple. You first have to click on this docs um hyperlink.
It will take you to a new page. Scroll down and then click on this link that says quick start for setting up your vector store. Scroll down again.
You will see this piece of code. Just copy it. Come back to your Superbase account and then go to SQL editor.
Click on new SQL snippet and paste the code that you had just now copied. After that, click on run. And if it shows success, no rows returned, then that means that your table has been created.
So if you come back to table editor, you will find a new table here named documents which would be empty. And that's all we needed to do. Now come back here and select your table which is going to be documents.
And that's it. Okay. Now we'll have to connect the embeddings.
So I'm going to use OpenI's embeddings for this one. You could use whichever you like. If you haven't connected your OpenI account, just do that.
You won't have to buy a separate subscription or anything. You just have to add money to your wallet, your API wallet in OpenI, and that's it. It's going to charge you from there.
If you want to save on cost, then go with small, which is recommended if you're learning or just doing it for the first time. Okay. And lastly, let's put the document loader, which is actually going to pass the document.
So once you click on this, select default data loader. Okay. These settings remain the same.
Then click on text splitter. Okay. So this is basically used to split the text into chunks so that later on it can be retrieved easily but we don't really want to do that otherwise our data would be here and there it's going to get broken and we have already uh you know combined it and we don't want to split it any further but since it is required we will set it up in such a way that it's not able to split our data.
So just go with character text letter and for the separator just put anything you feel like because we don't really want it to work anyways. And then for the chunk size also put a very high number so that it's not able to you know chunk our data or split it. After that just save it.
Great. Now we're going to go ahead and test it. So for that just click on test workflow.
And as you can see it has picked up the file. Now it's downloading it. Now it's extracting the data.
Then it would combine it and it would start uploading it to the vector store. This uploading process might take a few minutes if you have a large data set. Okay.
So all the records have been processed. As you can see we had 1,19 records here and then we have,9 here. So let's go back to Superbase to see if those have been uploaded.
So I'm just going to refresh the page and yes they have been uploaded. So if you see here, there are going to be exactly 1,09 records and each row in this particular table represents one row in our spreadsheet. So if you click on any of them, you will see the title, the description, you will find the price, the number of bedrooms and everything.
And here they have been converted into embeddings for the vector search. Great. So the uploading part is done.
Anytime you want to add to your uh vector store, you can just put in the files in this particular folder and it's going to be automatically uploaded to the vector store. You just had to do the setup once and now you can just um operate it from Google Drve. Now I'm going to make it such that you can chat with your data set.
So just like the example I showed you in the very beginning, but it's not necessary that you only have to chat with it. You can also use it somewhere else in your workflows in your NA and automations. Maybe you're analyzing data with AI or doing something similar, then you can use it there.
But for now, let's go with chat. So, I'm going to click on this plus icon and I'm going to select add another trigger and then we will go with on chat message. Okay, let's just test it once.
So, click on open chat and let's say hi. Okay, so this is tested. Now, we're going to add the AI agent node.
So basically AI agent is going to facilitate the chat. Um it's going to do the chat with you and whenever you ask a question it's going to forward it to the superbase vector store and it's going to get the results and then present it to you. So let's select define blue and then user message or you could also say user query but it's fine.
And then you drag and drop the chat input. So as you can see user message was hi. Then we're going to add the system message.
Okay. So I'm going to put a very simple system message which is whenever recommending properties always include all the information about the property like the address, the description, the price, the size, bedrooms and more because we want that whatever information it's getting from Superbase, it must present it to the user. Great.
Now let's connect a chat model. So I'm going to go with OpenAI and the model could be GPD40. Great.
Now we will also need memory because this is a chat agent. So we're going to go with simple memory and let's put it as 10. And lastly we're going to connect this superbase vector store using tools.
Okay. So click on this plus icon and then search for superbase. Then select superbase vector store.
So you will have to give it a name. So you can say something like knowledge retrieval or something similar whatever works for you. And then we will have to give it a description.
Okay, so it's a very simple description again. Semantically search the data and return the best matching properties. Okay, then the table is going to be documents.
And now for the limit, you can put it as three. If you want to search for three properties, if you want to search for five, you can put five. It's up to you.
I'm just going to go with three for now. Then just come out of it. And for embeddings, again, select um Open AI and the rest remains the same.
and then save it. Okay. So, let's chat with it to see if whether or not it's working.
So, I'm going to say I'm looking for a house. Let's put some location. It must have um five bedrooms, could be six.
Then let's see what is the price for something like this. So, a house is generally this much. So, let's put the let's put the price.
Price should be about let's change this to two to um 0 0. Okay, it must be well furnished. Okay, so here's our query.
Let's send it. So, as you can see, it is using the tool. And there we have it.
So, six bedroomedroom house um in this location description price. Okay, the price is way less. That's fine.
Bedroom six. Great. Okay, great.
So, it recommended um three properties as we had told it while setting up the tool. So, this is how you process large data sets using AI. So, let me talk about a few use cases here.
Let's say you have a large inventory and you would want an internal chatbot. So in that case you could use this um the staff could basically talk to it and you know confirm the inventory or if you wanted to be client facing you could have a website chatbot which is again connected to let's say um some data that you have stored on the back end or you could also use this setup for data analysis. So if you only upload uh CSVs then you can follow this approach whereas if you want to upload PDF files then you can skip these two nodes and you can directly connect the Google drive node to superbase because we don't really have to combine any rows or anything like that.
So I hope by now you have learned how you can process large data sets using AI. I'm going to include the code I've used and all the pieces of text that I've used uh in the description. Just look for the resources there.
And if someone's looking for this particular data set, again the link is going to be there. You can download this and you can use it. So I hope this video was valuable to you in some manner or the other.
If so, please consider liking the video and subscribing to the channel. If anyone is interested in advanced AI systems for their business, then the link to our website is in the description below. As I said, I run my own AI automation agency wherein we create AI systems for businesses.
for example, AI agents, AI workflows, AI infrastructures, etc. And if anyone's interested in consulting, then the link to the consulting calendar is also in the description. If there's anything else you would want me to cover in one of my future videos, then feel free to drop it in the comments below.
I hope I was able to make this as straightforward as possible for you. So, that's it for this video. I will meet you in the next one.
Until then, bye.