WEBVTT

00:02.760 --> 00:07.720
In this tutorial we are going to build our first rack agent.

00:09.200 --> 00:14.320
So rack stands for Retrieval Augmented generation, which basically means we give the large language

00:14.320 --> 00:17.440
model access to the external knowledge.

00:18.560 --> 00:23.880
So any kind of data you want usually that will be your own internal data or documents.

00:25.040 --> 00:32.600
So rack applications are kind of like custom gpts where you train ChatGPT to respond based on your on

00:32.640 --> 00:38.320
your own content or files instead of just its pretrained knowledge.

00:39.080 --> 00:46.720
And that's what's awesome about this setup, is that you can upload documents straight into Google Drive,

00:47.240 --> 00:51.000
and the chatbot will automatically learn from them.

00:51.160 --> 01:00.720
So every time you add something new, it will be vectorized to our vector database Is using this part

01:00.720 --> 01:05.320
of the workflow and instantly updates its knowledge base.

01:05.560 --> 01:10.560
This is incredibly useful for keeping your agent up to date without any manual work.

01:11.360 --> 01:13.600
So it will be done all automatically.

01:13.880 --> 01:15.720
We will use a practical example today.

01:15.720 --> 01:24.920
So let's say you are interested in the latest features introduced with iOS 18 from Apple, and you simply

01:24.920 --> 01:33.600
upload the official PDF document into your Google Drive, and the chatbot can immediately answer questions

01:33.880 --> 01:35.280
based on that content.

01:35.760 --> 01:40.360
So Apple could use this agent and embed it into their website.

01:40.360 --> 01:50.120
And any time a potential customer has questions about the new iOS 18 features, it could instantly access

01:50.120 --> 01:53.720
the vector database and provide an accurate answer.

01:53.720 --> 02:02.250
So that's why ROC agents are especially powerful for customer support as they give users real time answers

02:02.250 --> 02:05.970
based on the latest internal docs or updates.

02:06.530 --> 02:10.730
All right, so first open your workspace and create a brand new workflow.

02:11.730 --> 02:12.890
So create workflow.

02:13.610 --> 02:17.650
And let's start by adding our Google Drive to the node.

02:17.650 --> 02:21.890
So search for Google Drive.

02:26.610 --> 02:33.010
And we want to select the option that says on changes involving a specific folder because we want to

02:33.050 --> 02:34.010
automate the process.

02:34.010 --> 02:39.130
So when we add a new document into this folder this workflow will be triggered.

02:39.450 --> 02:45.730
So this node will watch drive folder and triggers whenever new files appear.

02:47.730 --> 02:51.010
Here of course we need to connect our Google Drive account.

02:51.050 --> 02:59.730
So if your Google Drive is not connected yet I click on this drop down create new credential And here

02:59.730 --> 03:02.250
you have to provide our client ID and client secret.

03:02.450 --> 03:08.810
If you don't know how to find those, go to the How to set up credentials section and you will find

03:08.810 --> 03:14.210
a separate tutorial on how to connect Google Apps into your account.

03:14.810 --> 03:21.570
If you if you have connected to your Google apps before, you can just simply sign in with Google to

03:21.610 --> 03:23.610
refresh the connection just in case.

03:24.210 --> 03:25.290
Now we can close it.

03:25.770 --> 03:30.730
Now we want this trigger to watch for our Google Drive folder every minute.

03:31.530 --> 03:35.010
But you can change it to every hour, every day.

03:35.650 --> 03:37.090
It's completely up to you.

03:37.450 --> 03:45.050
But in that case, I want this trigger to check my Google Drive folder every minute so it will be easier

03:45.050 --> 03:50.970
to test our automation and agent in the future steps.

03:51.250 --> 03:58.330
Now we want this automation to be triggered based on the changes involving a specific folder, so you

03:58.330 --> 04:01.930
can leave it as it is, but you can also change it to.

04:03.290 --> 04:09.090
Activate the workflow when it will notice changes to a specific file.

04:09.730 --> 04:11.050
Within your Google Drive.

04:11.530 --> 04:18.930
Now we want to create a dedicated folder in Google Drive to store this document.

04:19.210 --> 04:26.090
So I'm going to attach the iOS 18 new features document as a resource.

04:26.530 --> 04:28.130
So go to your Google Drive.

04:29.490 --> 04:30.570
Create a folder.

04:31.210 --> 04:36.450
I call mine First Rack Agent and then go to the new.

04:36.530 --> 04:41.730
Click this plus button and click on File Upload.

04:42.010 --> 04:46.170
And you can upload the same document or whatever document you want.

04:46.570 --> 04:52.450
Now when I click on this from list folder so we can select the folder and it should pop up.

04:52.850 --> 04:54.210
I can just search for it.

04:58.700 --> 05:00.980
As you can see, it appears here.

05:01.460 --> 05:02.740
So first rock agent.

05:03.980 --> 05:05.620
And we can watch for.

05:06.220 --> 05:09.460
And here we want to watch for file created.

05:09.460 --> 05:13.500
So when a file is created in the watch folder select that.

05:13.940 --> 05:17.820
And now we want to fetch the the test event.

05:18.060 --> 05:23.660
Because basically what we want to do we want to fetch the document we just uploaded.

05:24.300 --> 05:27.140
And we can see if the data come through.

05:29.860 --> 05:30.900
Yeah as you can see.

05:33.020 --> 05:34.700
As the output you have our data.

05:34.700 --> 05:36.340
We have our document right here.

05:37.300 --> 05:40.820
You can switch to the JSON format or to the schema.

05:44.780 --> 05:46.620
And everything should work perfectly.

05:49.180 --> 05:56.820
So yeah, it's a good practice to ensure that N810 pulls data about your your PDF file.

05:57.180 --> 06:00.180
So you should see the file name file file ID.

06:00.780 --> 06:03.940
So let's look for the file name.

06:13.980 --> 06:14.820
That is here.

06:15.260 --> 06:17.940
And also the filed is right here.

06:18.180 --> 06:19.620
And fetch a lot of more data.

06:19.620 --> 06:21.700
But we are interested just in a few fields.

06:22.740 --> 06:27.620
So we know that the document was fetched successfully so we can move on.

06:28.420 --> 06:29.420
So let's close it.

06:29.420 --> 06:31.020
Let's add another node.

06:31.500 --> 06:37.940
Now every time we add a new document into our Google Drive folder, it will be fetched by this trigger

06:37.940 --> 06:38.380
node.

06:38.540 --> 06:41.300
Now what we need to do we need to download this file.

06:41.460 --> 06:43.580
So we need to add another Google Drive node.

06:46.180 --> 06:47.500
So search for Google Drive.

06:49.100 --> 06:52.580
And this time we want as an action we want to download the file right.

06:53.180 --> 06:54.140
So click on that.

06:54.500 --> 06:58.940
So we want to download a specific file and the operation.

06:58.940 --> 07:00.980
We want to leave it as it is.

07:00.980 --> 07:01.820
So download.

07:01.980 --> 07:05.980
You can also copy a file, create from text, delete, etc..

07:07.740 --> 07:14.500
As you can see, after connecting this Google Drive node into our trigger node, the fetch data comes

07:14.500 --> 07:14.860
through.

07:15.180 --> 07:16.860
So we have it as an input now.

07:17.300 --> 07:23.220
Now this is very important because we don't want to select a specific file from from a list.

07:23.220 --> 07:26.500
So from our Google Drive we want to do it dynamically.

07:26.500 --> 07:33.100
So every time when we add a new file into our Google Drive folder it will be a different file.

07:33.140 --> 07:33.700
Right.

07:33.700 --> 07:37.380
So we need to add the file ID.

07:38.380 --> 07:42.380
So let's search for filed and we should find it.

07:42.700 --> 07:43.740
Add the spices.

07:44.260 --> 07:49.340
So let's search for this spices object.

07:54.180 --> 07:57.390
And as you can see here under spaces, we have our field.

07:57.830 --> 08:00.670
And the name of this file is exactly what we are looking for.

08:00.710 --> 08:05.110
So our iOS 18 all new features September 2024.

08:05.150 --> 08:08.950
So let's simply drag this ID and drop it right here.

08:10.030 --> 08:15.150
So now as you can see we successfully mapped the file into this field.

08:15.150 --> 08:16.430
So that's it for this note.

08:16.470 --> 08:17.390
Now let's move on.

08:17.910 --> 08:18.150
Yes.

08:18.150 --> 08:28.870
So we simply used the dynamic ID coming from uh this note node output to the ID field to download the

08:28.870 --> 08:31.150
correct file using this node.

08:31.310 --> 08:33.950
So now let's uh just rename this node to.

08:38.190 --> 08:38.990
Root file.

08:42.270 --> 08:47.590
And also let's rename this workflow to to vectorize data.

08:52.390 --> 09:00.630
From Google or from Drive the Pinecone, because we are going to use pinecone as our vector database.

09:04.350 --> 09:11.310
And we are going to vectorize files we store in our Google Drive folder to the Python vector store.

09:11.550 --> 09:16.710
Now the next step is to load this file into our vector database.

09:17.430 --> 09:22.110
So I really like pinecone vector database for rack agents.

09:22.390 --> 09:28.750
So before we add a new node go to Google and search for Python.

09:41.710 --> 09:45.910
Login or sign up if you don't have an account yet I'm going to log in.

09:49.430 --> 09:52.190
And as you can see, pinecone is a long term memory for AI.

09:52.430 --> 09:53.990
You can start building for free.

09:54.150 --> 10:02.550
So basically you can build at least a few rack agents for for free without paying the monthly subscription,

10:02.550 --> 10:04.470
which is really great for testing purposes.

10:04.870 --> 10:08.670
Now, once you log in, what you need to do, we need to create a new index.

10:08.670 --> 10:15.350
As you can see, I already have a couple of indexes, but for you it will be it will be completely empty.

10:15.830 --> 10:25.390
So I'm going to create new index, give it a name and a ten like agent.

10:26.950 --> 10:31.030
And the next thing is to configure our index.

10:31.030 --> 10:36.110
So what we need to do we need to choose text embedding.

10:36.150 --> 10:37.110
Very small model.

10:37.390 --> 10:40.270
This is most cost effective OpenAI embedding model.

10:40.310 --> 10:45.270
This is really important because we are going to use the same embedding the same embedding model in

10:45.270 --> 10:47.430
our Na ten application.

10:47.950 --> 10:52.110
So click on that and create index.

10:54.200 --> 11:00.840
Now the index has been successfully created and you don't need to worry about those details, but it's

11:00.840 --> 11:10.880
useful to know that the dimensions means that each text is stored as a list of 1535 numbers that capture

11:10.880 --> 11:14.480
its meaningful for smart searching for our agent.

11:15.160 --> 11:19.160
Now, the next thing we need to do, we need to create our API keys.

11:20.040 --> 11:22.240
So click on this API key section.

11:22.720 --> 11:24.080
Create new API key.

11:25.160 --> 11:26.000
Give it a name.

11:27.200 --> 11:32.080
My case is an agent create key.

11:33.760 --> 11:37.160
Simply copy it and let's go back to N810.

11:37.560 --> 11:42.240
Now what we are going to do we are going to search for pinecone.

11:45.480 --> 11:47.480
So we want to add a pinecone vector store.

11:52.600 --> 11:52.800
It.

11:52.840 --> 11:55.840
Of course, as the action, we want to add a document to a vector store.

11:56.520 --> 11:57.480
So click on that.

11:59.240 --> 12:01.560
Now we need to connect to our pinecone account.

12:01.560 --> 12:03.120
So let's create a new credential.

12:04.880 --> 12:05.920
Create new credential.

12:05.960 --> 12:12.000
And let's face the API key we just created and hit save.

12:12.600 --> 12:14.880
As you can see credential successfully created.

12:15.520 --> 12:16.720
So let's close it for now.

12:17.400 --> 12:24.800
Now feel free to use other vector databases so you can use different vector stores for example Supabase.

12:25.320 --> 12:28.560
So let's just quickly connect these nodes.

12:29.960 --> 12:35.600
And if you want to use other providers you can search for vector.

12:39.720 --> 12:41.400
And here we have simple vector store.

12:41.440 --> 12:43.240
We have a quadrant we have supabase.

12:43.760 --> 12:47.400
But for RAC agents I really like to use pinecone.

12:47.400 --> 12:49.360
So I'm going to stick with that.

12:50.840 --> 12:52.680
Now of course we need to configure this node.

12:52.680 --> 12:54.400
So let's open it.

12:55.760 --> 12:59.040
And the operation mode is of course insert documents.

13:00.800 --> 13:03.560
So we are going to leave it as it is.

13:04.280 --> 13:05.560
And now you have to.

13:06.160 --> 13:09.440
And now we have to select the pinecone index we have just created.

13:09.760 --> 13:13.560
So from the list I have created an agent.

13:13.560 --> 13:15.800
So I'm going to choose this one.

13:16.080 --> 13:18.640
You can leave embedding batch size as it is.

13:19.160 --> 13:21.120
And now we have to add the namespace.

13:21.680 --> 13:29.760
You can add the namespace directly in your Python account under databases right here.

13:31.840 --> 13:35.400
But I'm going to add the namespace in N810.

13:36.400 --> 13:40.280
So in this node I'm going to add option and Python namespace.

13:41.320 --> 13:44.680
And I'm going to call it rack agent.

13:47.200 --> 13:47.600
Right.

13:47.640 --> 13:48.200
That's great.

13:48.240 --> 13:51.370
Now let's close it safe.

13:51.850 --> 13:53.210
Now let's test our workflow.

13:57.650 --> 14:03.690
As you can see, we got an error because we have to add Embeddingmodel and we have to add document loader.

14:04.170 --> 14:05.130
So let's open it.

14:06.730 --> 14:10.170
But we successfully downloaded the file.

14:10.530 --> 14:12.170
We add it to our Google Drive folder.

14:13.130 --> 14:16.850
So now let's close it down and let's add the Embeddingmodel.

14:17.090 --> 14:19.010
I really like OpenAI's embeddings models.

14:19.010 --> 14:20.610
So I'm going to choose this one.

14:22.770 --> 14:29.290
And here you have to ensure that the model you are selecting is the same model we use in the Python.

14:29.290 --> 14:32.850
So it was text embedding free small model.

14:33.530 --> 14:39.130
You have also access to the large model and Ada 002.

14:40.490 --> 14:43.930
Also make sure that your OpenAI account is connected.

14:44.530 --> 14:45.770
And that's it for this node.

14:45.770 --> 14:48.370
So let's close it down and move on.

14:50.650 --> 14:51.850
Now we have to add document.

14:51.890 --> 14:56.690
As you can see, we are going to use the default data loader.

14:56.690 --> 15:01.010
So we want to load data from previous step in the workflow.

15:02.610 --> 15:04.690
So in that case from the download file.

15:05.970 --> 15:07.170
So let's choose this one.

15:07.450 --> 15:14.490
And as you can see as the input we fetch the iOS 18 file.

15:14.810 --> 15:17.810
And this is in the PDF format.

15:18.290 --> 15:23.490
So you can view it just by clicking on this button.

15:27.490 --> 15:31.450
This in JSON format the table schema.

15:31.890 --> 15:35.210
So we downloaded the file in a PDF format.

15:35.250 --> 15:37.050
So this is not the JSON format.

15:37.290 --> 15:39.450
So we need to change the type of data.

15:39.930 --> 15:41.250
It's going to be binary.

15:41.250 --> 15:44.530
So we want to process the binary data from the previous node.

15:45.050 --> 15:46.090
So let's click on that.

15:46.650 --> 15:46.970
Yes.

15:46.970 --> 15:51.810
So we are using the PDF, uh, document in this example.

15:52.130 --> 15:55.290
We can leave mode as load or input data.

15:55.330 --> 15:59.410
You can also switch over to load specific data if you want to.

15:59.850 --> 16:05.330
So this is this will be load data from a specific field in the parrot agent or chain which is a little

16:05.370 --> 16:06.450
bit more complicated.

16:06.930 --> 16:08.210
So let's stick with that.

16:08.210 --> 16:12.090
And as a data format you can leave it as it is.

16:12.130 --> 16:14.730
So automatically detect by Mime type.

16:15.090 --> 16:22.250
But you can also switch to the PDF because we are using the PDF document.

16:22.650 --> 16:24.090
So load PDF document.

16:24.130 --> 16:24.330
Yes.

16:24.330 --> 16:32.770
So if you want to sometimes upload different type of documents such as docs or uh, CSV files into your

16:32.810 --> 16:35.930
Google Drive folder, you can use this option.

16:36.250 --> 16:38.250
But in that case we are going to use PDF.

16:38.770 --> 16:39.890
Now let's close it down.

16:40.210 --> 16:42.450
Now next we need to add the text splitter.

16:42.610 --> 16:48.740
So we are going to use the accuracy for character text beta which means that it will split text into

16:48.740 --> 16:50.980
chunks by characters recursively.

16:51.420 --> 16:53.860
And it's recommended for most use cases.

16:54.140 --> 16:59.020
I recommend using it for RAC agents for better accuracy.

16:59.140 --> 17:00.700
So we are going to use this one.

17:01.380 --> 17:10.860
Now what this recursive character text splitter does is it breaks long text into smaller chunks so they

17:10.860 --> 17:15.100
can be processed or embedded properly by LMS.

17:15.500 --> 17:24.380
So no overlap means each chunk is separate and does not share text with the next one.

17:24.420 --> 17:31.780
So for this size of document, around 900 characters um with an overlap of 50 works really well.

17:31.980 --> 17:38.820
So it keeps each chunk short enough for processing, while the overlap helps preserve context between

17:38.820 --> 17:43.060
chunks, which is great for better search and retrieval accuracy.

17:43.100 --> 17:50.660
So here we are going to enter 100 and check overlap 50.

17:51.460 --> 17:58.100
Now let's test it and see if we are able to upload this file into our vector store.

17:58.540 --> 17:59.660
So let's close it.

17:59.700 --> 18:00.700
Let's hit save.

18:00.700 --> 18:04.420
And let's go quickly back to our icon.

18:05.740 --> 18:10.260
When you click on this index, as you can see there is no records yet.

18:11.380 --> 18:17.660
And the record is an object to add to an index which contains vector and some metadata.

18:18.180 --> 18:27.180
So now when we go to our workflow and click on Test Workflow, it should populate our namespace with

18:27.180 --> 18:27.700
the vectors.

18:27.700 --> 18:32.860
So it should split the document we uploaded into our Google Drive folder.

18:33.140 --> 18:39.980
As you can see, it keeps executing because it's waiting for us to create an event in Google Drive.

18:39.980 --> 18:44.460
So to upload the new file into our Google Drive folder.

18:44.660 --> 18:47.660
So what I'm going to do I'm going to pin the data.

18:49.140 --> 18:50.140
So let's stop it.

18:51.940 --> 18:56.740
I don't need to upload a new file into our Google Drive.

19:03.980 --> 19:05.300
So I'm going to pin it.

19:14.540 --> 19:24.940
Oh, it actually successfully vectorize our file and added it to our Python vector store.

19:25.860 --> 19:28.900
As you can see we have a ten hits now.

19:30.460 --> 19:35.900
So as you can see our document has been splitted and embedded into our vector store.

19:37.820 --> 19:40.060
We have 80 documents.

19:41.060 --> 19:48.830
And just to confirm as you can see we have 80 items as an output from our Python vectors to node.

19:49.190 --> 19:54.630
So we successfully downloaded the file from our Google Drive folder.

19:54.790 --> 20:01.670
So what we have done here is the automation was triggered when a new file was added to our Google Drive.

20:01.950 --> 20:08.510
It downloaded the file, then passed it to the default data loader to extract the content.

20:08.790 --> 20:14.790
That content was split into smaller chunks using recursive character text beta.

20:15.590 --> 20:19.790
Those chunks were then sent to OpenAI to generate embeddings.

20:20.350 --> 20:27.190
And finally, all the embeddings were stored into in our Python vector store for semantic search.

20:27.550 --> 20:35.110
So our agent will be able to go through those embeddings and do semantic search technique to retrieve

20:35.110 --> 20:39.110
the most relevant information based on the questions from the user.

20:39.470 --> 20:46.150
Naturally, you will want to upload more than one file into your Google Drive to improve the knowledge

20:46.150 --> 20:48.190
base for your RAC agents.

20:49.190 --> 20:54.510
So if you are planning to add more data inside your Python vector store.

20:55.230 --> 20:58.950
So Python vector database for example.

20:59.310 --> 21:03.950
So let's say Apple just released a new version of this document.

21:05.910 --> 21:11.670
And he would and he would probably want to drop that into your uh drive folder.

21:12.270 --> 21:17.510
So there is a way to keep everything more organized and easy to track.

21:17.750 --> 21:21.550
So you can attach metadata in any workflow.

21:21.830 --> 21:28.950
So that way, once the document is stored in your vector database, you will see the actual file name

21:29.150 --> 21:29.870
right here.

21:31.070 --> 21:33.590
So this is super useful for staying organized.

21:33.590 --> 21:36.390
So I will show you how to set that up in a second.

21:36.710 --> 21:43.390
But also quick tip if you are using your RAC agent to handle completely different topics and unrelated

21:43.480 --> 21:44.200
documents.

21:44.480 --> 21:48.360
It's a really good idea to create separate namespaces for each category.

21:48.360 --> 21:50.640
So for each, for each project.

21:50.760 --> 21:56.320
So now if you want to add um metadata go to default data loader node.

21:58.720 --> 21:59.680
Under options.

21:59.720 --> 22:00.560
Add option.

22:01.680 --> 22:02.680
Add metadata.

22:04.440 --> 22:05.400
Add property.

22:06.200 --> 22:07.160
Give it a name.

22:07.200 --> 22:09.040
So I'm going to call it Apple.

22:10.680 --> 22:18.480
And you have to drop here the name of the file to fill out this dynamically.

22:19.400 --> 22:21.840
So switch to switch over to mapping.

22:22.200 --> 22:23.280
Then go to schema.

22:25.600 --> 22:26.760
Look for spaces.

22:32.880 --> 22:34.320
And right here we have a name.

22:35.200 --> 22:38.040
Let's let's drag it and drop it right here.

22:40.960 --> 22:42.800
So as you can see it's all green and results.

22:42.800 --> 22:43.480
We have a name.

22:44.400 --> 22:45.280
Let's close it.

22:46.520 --> 22:47.920
Just unpin this data.

22:50.880 --> 22:51.600
Let's save it.

22:51.640 --> 22:53.880
Now go to pinecone.

22:54.360 --> 22:57.040
I'm going to delete this, uh, namespace.

23:00.680 --> 23:04.120
So delete that agent.

23:06.280 --> 23:07.600
And delete namespace.

23:08.160 --> 23:11.040
And I'm going to run this workflow once again.

23:11.920 --> 23:15.360
So now I'm going to upload the same file to.

23:15.400 --> 23:16.320
My Google drive.

23:20.200 --> 23:21.040
So new.

23:23.600 --> 23:24.320
Upload.

23:35.080 --> 23:37.920
Now let's go back to our workflow.

23:42.760 --> 23:45.120
So you need to make sure that your workflow is active.

23:45.120 --> 23:50.240
So that way our that way our trigger will watch our folder.

23:50.920 --> 23:52.560
So let's make this workflow active.

23:54.640 --> 23:57.760
Confirm I uploaded the file twice.

23:59.600 --> 24:02.120
As you can see two uploads complete.

24:04.920 --> 24:06.480
Now we will go to executions.

24:08.720 --> 24:11.960
You can see that it successfully uploaded the file.

24:12.400 --> 24:14.560
It's all green so there is no any errors.

24:17.080 --> 24:19.480
Now let's go to our pinecone vector store.

24:21.480 --> 24:24.680
As you can see, we have a record of 160.

24:25.640 --> 24:26.760
So let's open it.

24:28.320 --> 24:30.920
Go to the browser, refresh it.

24:31.320 --> 24:33.920
And now you can see that the metadata has been added.

24:33.920 --> 24:40.520
So I can see the exact name of the file I just vectorize to my vector store in Python.

24:40.840 --> 24:41.170
All right.

24:41.170 --> 24:41.650
Great.

24:42.130 --> 24:48.130
So yes, if you want this automation to run every time you drop a new file into your Google Drive folder,

24:48.130 --> 24:49.850
make sure to activate your workflow.

24:51.210 --> 24:57.650
And once it's active, it will automatically pick up new files, process them, and store them in your

24:57.690 --> 24:58.970
icon vector database.

24:59.810 --> 25:03.290
We built our RAC agents knowledge base using pinecone.

25:03.930 --> 25:11.570
Now every time we add a new PDF file like the latest iOS 18 features to our Google Drive, the knowledge

25:11.610 --> 25:13.410
base updates automatically.

25:13.930 --> 25:18.770
So now we are going to build an actual chatbot that uses this knowledge to answer questions.

25:19.090 --> 25:24.970
So by the end, you will be able to ask your chatbot anything from your uploaded document and get clear,

25:25.490 --> 25:26.570
accurate answers.

25:27.210 --> 25:32.650
Now, before we dive into building the chatbot, there is something very important to keep in mind about

25:32.650 --> 25:35.370
how vector databases like pinecone work.

25:35.530 --> 25:41.090
So even though they are super powerful for storing and searching through document data.

25:41.970 --> 25:43.090
They are not unlimited.

25:43.090 --> 25:50.250
So over time, as you keep uploading new documents, your database can start to get cluttered or even

25:50.290 --> 25:52.410
hit storage limits depending on your plan.

25:52.690 --> 25:55.930
So it's a good idea to keep things clean and well organized.

25:56.370 --> 26:04.450
So don't just dump in every single file you ever created, especially if they are huge PDFs with images

26:04.610 --> 26:12.010
or unstructured content, because that kind of data is not ideal for llms to to work with anyway, and

26:12.010 --> 26:14.650
it can make responses less accurate.

26:15.050 --> 26:22.130
So instead, try to keep your documents, uh, relevant, uh, concise and well formatted.

26:22.410 --> 26:27.650
So if you are no longer using certain data, it's totally fine and recommended to remove it from the

26:27.650 --> 26:30.490
vector store to make room for new updates.

26:31.090 --> 26:31.570
So.

26:32.290 --> 26:35.570
So now let's move on and start building the actual agent.

26:36.170 --> 26:37.530
So creating workflow.

26:38.050 --> 26:40.250
Then we need to add our first note, let's show.

26:40.250 --> 26:45.250
Let's add the agent to search for an agent.

26:51.210 --> 26:52.290
Now let's close it.

26:52.890 --> 26:54.490
Let's add our chat model.

26:55.330 --> 27:00.930
So we're going to use OpenAI model GPT four.

27:00.970 --> 27:03.930
I recommend to use GPT four for more accuracy.

27:20.010 --> 27:20.530
All right.

27:20.530 --> 27:23.170
So make sure you OpenAI account is connected.

27:23.170 --> 27:29.450
But it should be automatically connected if you set up your credentials in the workspace and in the

27:29.450 --> 27:29.890
project.

27:29.890 --> 27:31.810
So let's close it for now.

27:32.930 --> 27:39.180
Now we need to give our agent clear instructions on how to respond.

27:40.060 --> 27:42.100
So let's configure this node.

27:43.180 --> 27:45.180
Now let's add system message.

27:46.140 --> 27:47.980
So here we have to add our prompt.

27:48.780 --> 27:52.860
Let's switch over to expression mode and expand the editor.

27:55.340 --> 27:58.020
I'm going to paste the prompt I have prepared earlier.

27:58.380 --> 28:06.500
You can simply create the prompt with the help of ChatGPT or cloud, or you can modify this one.

28:06.500 --> 28:07.980
This is just a template for you.

28:09.300 --> 28:12.060
So let's say we can improve it.

28:13.580 --> 28:15.220
So you can say this is the role.

28:15.580 --> 28:21.500
So you are an assistant trained to answer questions specifically based on the iOS 18 feature documents

28:21.500 --> 28:23.900
stored in the Connected Vector database.

28:24.460 --> 28:25.620
And as the objective.

28:29.660 --> 28:34.860
Your job is to help users clearly understand the new features, settings, and changes introduced in

28:34.860 --> 28:41.060
iOS 18 by retrieving and referencing only the information available in the documents stored in the vector

28:41.060 --> 28:41.420
store.

28:41.780 --> 28:47.100
The user asks something that is not included in the uploaded content, or if the answer is not clear

28:47.100 --> 28:53.820
from the available data, let them know that the information is not currently available and also we

28:53.820 --> 28:55.820
can call it rules.

28:57.980 --> 28:59.460
So be clear and direct.

29:00.540 --> 29:10.860
Avoid Overexplaining I would say also use 3 to 5 sentences.

29:13.380 --> 29:17.740
Now with bullet points or short paragraphs when listing multiple features.

29:18.540 --> 29:23.020
If a feature only applies to certain devices or release phases like beta stable, make them clear.

29:23.020 --> 29:26.780
When mentioned in the comments, you can just remove it.

29:28.140 --> 29:29.300
Never guess or assume.

29:29.300 --> 29:33.020
Stick strictly to what's inside the vector database content.

29:33.020 --> 29:40.460
This is really important and my objective If is deliver helpful, accurate and easy to understand answers

29:40.460 --> 29:51.140
about the iOS 18 using only the documents, let's say answers using only the documents available in

29:51.180 --> 29:51.900
the vector store.

29:51.900 --> 29:55.060
So no speculation, no extra assumptions, and no external sources.

29:55.460 --> 29:55.780
All right.

29:55.780 --> 29:56.380
Brilliant.

29:57.540 --> 30:00.340
This prompt should work perfectly fine.

30:01.620 --> 30:02.700
Now let's close it.

30:04.660 --> 30:09.180
Now, to make our agent interactions feel natural, let's add a memory.

30:10.220 --> 30:11.660
So let's add simple memory.

30:13.820 --> 30:17.220
And let's set it to the last ten messages.

30:21.980 --> 30:24.980
So now your agent will really remember context.

30:25.500 --> 30:25.860
All right.

30:25.860 --> 30:26.380
Great.

30:27.140 --> 30:34.780
So for example, without memory, the agent will forget details immediately.

30:34.780 --> 30:41.670
So When I say hi, my name is Damien and then ask, what's my name?

30:41.870 --> 30:49.550
The chatbot will not be able to answer this question, but once he added the simple memory, it will

30:49.550 --> 30:52.590
be able to remember my name.

30:53.150 --> 30:56.270
So now when I test it and I open the chat.

30:57.750 --> 31:02.910
Hi, my name is Damien, I like dogs.

31:08.350 --> 31:09.670
Hi, Damien, it's nice to meet you.

31:09.670 --> 31:16.630
If you have any questions about the new features or changes in iOS 18, feel free to ask what's.

31:21.310 --> 31:21.910
My name?

31:27.230 --> 31:30.550
What animals I like.

31:33.630 --> 31:36.270
You mentioned that your name is Damien and that you like dogs.

31:37.070 --> 31:37.350
All right.

31:37.350 --> 31:37.870
So great.

31:37.910 --> 31:39.670
This is how the memory works.

31:39.670 --> 31:41.990
So this is great.

31:41.990 --> 31:48.790
And and because of the memory, you can sometimes feel that you chat with the real human.

31:49.430 --> 31:49.950
Okay.

31:50.270 --> 31:51.430
So let's close it for now.

31:52.590 --> 31:58.030
Next thing we need to connect the vector database.

31:58.710 --> 32:02.950
So our agent can pull information directly from our documents.

32:04.070 --> 32:13.270
We just vectorized and load it from our Google Drive folder into our pinecone vector store.

32:13.710 --> 32:23.390
Actually, let's check if I ask our agent to about anything included in the iOS 18.

32:25.470 --> 32:26.710
Features document.

32:28.470 --> 32:34.590
It will be hallucinate or just state that is not able to answer these questions because it doesn't have

32:34.670 --> 32:41.830
this information, access to this information as we want because we just added it to our prompt.

32:44.190 --> 32:44.870
Right here.

32:45.470 --> 32:50.030
So if a user asks something that is not included in the uploaded content, etc..

32:50.870 --> 32:54.150
So now let's test our agent again.

32:55.030 --> 32:56.550
Let's ask it about.

33:00.910 --> 33:02.630
What's in the playground.

33:04.270 --> 33:05.270
Let's copy it.

33:15.150 --> 33:21.030
As you can see, the information about the playground is in iOS 18 is not available in the documents

33:21.030 --> 33:21.510
I have.

33:21.550 --> 33:29.670
And this is what we expect because we have not connected our pinecone vector database to our agent.

33:29.670 --> 33:33.150
So now we are going to now we are going to add a tool.

33:33.670 --> 33:39.440
We're going to add the search for vector.

33:41.320 --> 33:43.120
And this is the tool we are going to use.

33:43.120 --> 33:45.920
So vector store question answer tool.

33:45.920 --> 33:48.600
So it answers questions with a vector store.

33:49.880 --> 33:53.800
So simply add it and let's configure it later.

33:56.840 --> 33:59.200
Now what we need to do we need to add the vector store.

33:59.200 --> 34:01.520
We just we have created in the previous steps.

34:02.720 --> 34:05.760
So we are going to add our vector store.

34:08.280 --> 34:14.320
If you have created your own vector store earlier it will be connected automatically as operation mode.

34:14.320 --> 34:17.720
We want to retrieve documents as a vector store for training tool.

34:18.440 --> 34:20.160
So we are going to leave it as it is.

34:20.640 --> 34:24.440
And here we are going to select our Python index.

34:27.360 --> 34:30.000
So it was an RAC agent in my case.

34:32.040 --> 34:32.920
Okay great.

34:33.760 --> 34:37.640
So now as you can see you also need to add embedding model.

34:38.160 --> 34:41.760
So we are going to use OpenAI embedding model.

34:42.240 --> 34:49.120
The same you used for our Python vector store which is text embedding free small model.

34:50.760 --> 34:51.560
Close it.

34:53.120 --> 34:55.480
Now you have to add our model.

34:58.960 --> 35:01.520
So I'm going to use GPT for all.

35:04.240 --> 35:06.000
I'm going to switch to GPT for all.

35:08.640 --> 35:09.480
Okay great.

35:10.320 --> 35:11.760
And now we can configure this node.

35:13.800 --> 35:16.080
So now we have to give it a name.

35:16.080 --> 35:18.800
So let's call it iOS.

35:22.000 --> 35:22.720
18.

35:26.080 --> 35:32.960
And also the name of this node will be the same to name it.

35:33.480 --> 35:38.280
And here we have to specify when we want to call this tool by our agent.

35:38.960 --> 35:40.800
Now we have to add the description of the data.

35:40.800 --> 35:46.600
So when you hover over for this question mark you can see that we need to describe the data in the vector

35:46.600 --> 35:46.920
store.

35:46.920 --> 35:50.040
So this will be used to fill this tool description.

35:50.800 --> 35:58.880
So we can say something like I'm going to enter into the expression and useful for when you need to

35:58.880 --> 36:05.120
answer questions about iOS 18 finds and returns the most relevant information from the documents in

36:05.120 --> 36:11.120
the vector database like features, update settings or changes in the new iOS version.

36:11.120 --> 36:14.880
Whenever you need information about iOS 18, you should always use this tool.

36:15.880 --> 36:16.240
All right.

36:16.280 --> 36:16.600
Great.

36:16.600 --> 36:17.880
So now let's close it.

36:19.200 --> 36:20.200
Let's save it.

36:20.400 --> 36:27.120
Now the best format for Llms, especially when they are doing semantic search through a vector databases,

36:27.360 --> 36:28.600
is actually marked down.

36:28.880 --> 36:31.730
So that's the most LM friendly Structure.

36:32.330 --> 36:35.570
As you probably remember, we're currently using a PDF.

36:35.850 --> 36:42.570
And while PDF is not the perfect format for our agent, it will still work completely fine in this setup.

36:43.330 --> 36:49.130
That said, we can improve the accuracy and relevance of the responses by taking one extra step.

36:49.130 --> 36:56.250
And that's, uh, specifying the pinecone namespace we created earlier in our vector store.

36:57.010 --> 37:04.370
So setting the namespace will help the agent stay focused on just the right chunk of data, and avoid

37:04.370 --> 37:08.690
mixing it with unrelated information if you are using multiple sources.

37:09.810 --> 37:16.170
So if you don't remember the name of the namespace you created, just go to your pinecone vector store

37:16.690 --> 37:17.890
and the namespace.

37:18.450 --> 37:24.250
And under namespaces you will see the name of the namespaces you created.

37:24.690 --> 37:26.490
So mine is rug agent.

37:28.290 --> 37:36.250
So now what we need to do we are we need to go to the pinecone vector node at option and add pinecone

37:36.250 --> 37:41.330
namespace and type the name of the namespace you created.

37:41.690 --> 37:47.650
As you can see, the partition the records in an index into namespaces.

37:48.770 --> 37:50.330
So mine is RAC agent.

37:53.410 --> 37:53.810
All right.

37:53.810 --> 37:54.130
Awesome.

37:54.130 --> 37:55.970
Now let's test our agent.

37:56.850 --> 37:58.330
For that let's click save.

37:59.530 --> 38:00.650
Let's open the chart.

38:01.490 --> 38:03.330
And now let's ask the same question.

38:15.850 --> 38:21.410
As you can see uh, now it is able to answer our question.

38:21.970 --> 38:26.770
So Image Playground in iOS 18 allows users to create and manipulate images through various tools and

38:26.810 --> 38:34.250
options, including creating images, generating images, saving sinking creations and so on.

38:34.290 --> 38:38.810
Now you can go to our document and check if it's true or not.

38:39.650 --> 38:41.010
Yes, you can see it's correct.

38:42.250 --> 38:42.650
All right.

38:42.690 --> 38:43.170
Awesome.

38:44.850 --> 38:45.930
So let's close it.

38:48.530 --> 38:48.890
All right.

38:48.890 --> 38:54.810
So now I'm going to show you how to share your agent with other people so they can start using it too.

38:55.090 --> 38:57.730
So first make sure your agent is set to active.

38:58.370 --> 39:01.930
Otherwise it would work for anyone outside your account.

39:01.930 --> 39:05.690
So just toggle it from inactive to active and you are good to go.

39:07.730 --> 39:08.730
And confirm it.

39:09.210 --> 39:18.890
Next click on your one chat message received trigger note and and then you have to make the chat publicly

39:19.130 --> 39:19.810
available.

39:21.970 --> 39:24.130
And here is the link you can share.

39:25.610 --> 39:32.540
So now you can copy this link and share it with clients team Members or embed in, uh, or embed it

39:32.580 --> 39:36.420
on a website so they will be able to open it in their browser.

39:36.660 --> 39:40.340
Ask questions and interact with your agent just like you do.

39:40.780 --> 39:43.500
So let's copy this link and see how it looks like.

39:45.500 --> 39:48.500
I'm going to paste it to my browser.

39:51.020 --> 39:51.700
And voila!

39:52.180 --> 39:56.180
As you can see, you can interact with your agent right here.

39:56.220 --> 39:58.180
You can of course change the initial message.

39:58.180 --> 40:03.340
So when you go to N810, you can modify the initial message right here.

40:04.660 --> 40:06.660
And you can make it look nicer.

40:06.660 --> 40:10.980
And I'm going to show you exactly how to do that in one of the upcoming lessons.

40:11.460 --> 40:12.820
So stay tuned for that.

40:13.940 --> 40:16.660
You have successfully built your first rack agent.

40:16.700 --> 40:23.940
You now have a fully working AI chatbot that can search your documents and answer questions using real

40:23.940 --> 40:24.460
data.

40:24.620 --> 40:26.060
So this is a huge milestone.

40:26.420 --> 40:29.260
So congrats again and see you in the next episode.
