WEBVTT

00:00.160 --> 00:02.360
Hello everyone and welcome.

00:02.800 --> 00:08.960
In this video we will continue where we left off in our previous video where we created an multimodal

00:09.000 --> 00:11.720
Agentic React architecture pipeline.

00:12.200 --> 00:15.080
In this video we will continue from there.

00:15.320 --> 00:21.240
We will create another tool which will get us details about the seven wonders of the world, and we

00:21.240 --> 00:22.640
will ask queries.

00:22.840 --> 00:28.520
Depending on the question, the agent will pick up the particular tool and answer questions.

00:28.880 --> 00:31.440
So now I have to first index the data.

00:31.560 --> 00:38.600
We will start by getting the data from the Hugging face seven wonder space that they have created,

00:38.800 --> 00:41.240
and then index them in our database.

00:41.520 --> 00:45.680
So now this is the data sets that I'm loading from the hugging face.

00:45.800 --> 00:49.560
I'm printing the data here to learn how the data looks like.

00:50.040 --> 00:53.920
So in this case here this is a document from Hugging Face.

00:54.240 --> 00:59.160
It has a document ID and the content about the different wonders of the world.

00:59.640 --> 01:04.360
Now I'll go ahead and index a document in memory document store.

01:04.980 --> 01:08.260
So here we created an in-memory document store.

01:08.740 --> 01:12.540
For that I will have to use the sentence transformer.

01:12.820 --> 01:16.700
All mini LM model will download the model.

01:17.020 --> 01:19.620
We'll embed the document with this embedder.

01:19.980 --> 01:22.580
And then we'll write the document to the store.

01:22.620 --> 01:29.820
Once it's embedded and then once the documents are embedded in the document store, we initialize it

01:29.820 --> 01:32.380
with the in-memory retriever object.

01:32.620 --> 01:37.020
You can either do this or you can create a pipeline out of this.

01:37.540 --> 01:39.780
Whatever works best for you.

01:40.460 --> 01:45.980
Now that we have the retriever ready, we need to build a retriever pipeline for our questions.

01:46.340 --> 01:54.540
So for that we need a sentence transformer, text retriever, in-memory embedding retriever, and a

01:54.540 --> 01:55.620
prompt builder.

01:56.260 --> 02:05.580
So I have three different prompt components initialized in memory embedding retriever sentence transformer

02:06.140 --> 02:09.050
text Embedder to embed questions.

02:09.850 --> 02:16.170
This will help us fetch the top K document, and then prompt Builder would help construct the prompt

02:16.170 --> 02:18.250
that our agent would eventually use.

02:18.530 --> 02:27.490
So I created this pipeline seven Wonders Pipeline and added components text Embedder retriever and Prompt

02:27.490 --> 02:28.970
Builder to the pipeline.

02:29.290 --> 02:36.450
And then I'm connecting the pipeline as text Embedder to Retriever retriever to the prompt builder.

02:37.170 --> 02:41.490
Now let's go to the next step here which is running the retrieval pipeline.

02:41.970 --> 02:47.970
I'm running the Seven Wonders pipeline with text Embedder as the embedding component.

02:48.490 --> 02:53.770
The question that I'm asking here is what does road Statue look like?

02:54.010 --> 02:56.330
And then I'm printing the response.

02:56.810 --> 03:00.730
Let me go ahead and run the code blocks that I might have missed in the video.

03:01.210 --> 03:02.570
So we went through this.

03:02.930 --> 03:11.450
There are a 151 documents that it wrote creating and initializing the components, adding it to the

03:11.450 --> 03:12.330
pipeline.

03:12.830 --> 03:14.710
and then running the pipeline.

03:15.230 --> 03:18.470
So I did get the response here about the road statue.

03:18.870 --> 03:20.990
Let's confirm how this looks like.

03:21.430 --> 03:23.470
So here's the content that I got.

03:23.830 --> 03:27.790
And if you notice here it is relevant to the road statue.

03:28.310 --> 03:33.590
The next step is to create the tool with Seven Wonders pipeline.

03:34.110 --> 03:43.030
So for that I have imported the Fast Drag Tools library with document with Image Query tool as a the

03:43.030 --> 03:44.590
tool that I'll use here.

03:44.670 --> 03:50.830
I'm giving the name as seven Wonders tool, and then the description is useful for when you need to

03:50.870 --> 03:53.270
retrieve Fact of seven wonders.

03:53.790 --> 03:57.710
It can give you information about one wonder per query.

03:58.350 --> 04:00.070
Pass the wonder as input.

04:00.070 --> 04:06.550
This is a very important step where it uses the name and the description of its functionality to decide

04:06.550 --> 04:08.070
which tool to invoke.

04:08.550 --> 04:11.510
Agent uses this information appropriately.

04:11.910 --> 04:17.980
So please make sure that the description and the name is very relevant to the task.

04:18.340 --> 04:22.900
And then this is the pipeline that we have specified up here.

04:23.300 --> 04:23.820
Right.

04:24.300 --> 04:26.780
Let's execute this okay.

04:27.180 --> 04:29.620
So we got the seven wonder as a tool.

04:29.620 --> 04:30.180
Ready.

04:30.780 --> 04:32.660
Now let's go ahead and invoke this.

04:32.940 --> 04:38.820
So here is the next piece of code that says seven wonder tool that we created up here.

04:39.260 --> 04:41.260
Road statue is the input.

04:41.580 --> 04:45.660
Then I get the tools result and then I'll print the response.

04:45.900 --> 04:47.860
So we got the response.

04:48.100 --> 04:54.300
And if you notice here we have the information about road statue and the details that we got from the

04:54.300 --> 04:55.140
pipeline.

04:55.420 --> 04:58.420
I went ahead and tried a different option for the pipeline.

04:58.700 --> 05:03.940
In this case I wrote pyramid and it came back with the information of pyramid.

05:04.380 --> 05:09.660
Now let's go ahead and use the generator to come up with the entire agent experience.

05:10.100 --> 05:15.100
So here I have imported the agent and tools manager from the FastTrack.

05:15.580 --> 05:21.480
Along with that, I am also importing the conversation Memory with the agent class.

05:21.840 --> 05:24.040
Here, there's a generator.

05:24.280 --> 05:26.240
There's a prompt template tool.

05:26.560 --> 05:29.960
It is different in our case, which is seven wonders tool.

05:29.960 --> 05:30.840
Conversation.

05:30.840 --> 05:31.480
Memory.

05:31.760 --> 05:34.560
We pass it to the generator and we run this.

05:35.080 --> 05:37.320
How does road statue look like?

05:37.600 --> 05:39.120
Let's execute this.

05:39.760 --> 05:44.480
So the thought is I need to find out the appearance of the road statue.

05:44.800 --> 05:47.720
It's using the tool seven wonder tool.

05:48.040 --> 05:50.160
The input is road statue.

05:50.160 --> 05:53.920
And then it gave us the response back from the pipeline.

05:54.120 --> 05:58.720
And this is generating the response from the content.

05:59.280 --> 06:02.360
Now what if we run two tools at the same time.

06:03.440 --> 06:10.840
So in this case what we need to do is we need to add one more tool that we created in the previous video.

06:11.200 --> 06:15.120
The tool was nutrition tool that we created in the previous video.

06:15.520 --> 06:19.320
Let's go ahead and ask a question about how does Road Statue look like?

06:19.560 --> 06:23.240
And the agent has two tools to evaluate and pick one.

06:23.550 --> 06:27.310
Let's see if the agent can do justice to the tool's invocation.

06:27.710 --> 06:32.550
So in this case, the user is asking for the appearance of the road statue.

06:32.910 --> 06:40.070
Then it picked up seven Wonders tool, and we got all the information from the retrieval pipeline to

06:40.110 --> 06:43.950
whatever we had before, and then it summarized it.

06:44.270 --> 06:46.230
I will use another query.

06:46.550 --> 06:49.790
How much protein does protein bar have?

06:50.270 --> 06:53.310
And then execute this one more time.

06:53.790 --> 06:57.790
So the thought is the protein content in the protein bar.

06:58.230 --> 07:04.310
It invoked the nutrition tool and it invoked the necessary prompt with image.

07:04.870 --> 07:07.630
It got the information from the content.

07:08.030 --> 07:12.990
And then the final answer was that protein bar has 14g of protein.

07:13.190 --> 07:14.150
That's amazing.

07:14.630 --> 07:19.030
It was able to invoke the right tool to the right question that was asked.

07:19.430 --> 07:24.870
I hope you learned Multiagent application with Multi-hop using React architecture.

07:25.110 --> 07:28.070
Thank you and I'll see you in the next video.
