Hello everyone and welcome.
In this video we will continue where we left off in our previous video where we created an multimodal
Agentic React architecture pipeline.
In this video we will continue from there.
We will create another tool which will get us details about the seven wonders of the world, and we
will ask queries.
Depending on the question, the agent will pick up the particular tool and answer questions.
So now I have to first index the data.
We will start by getting the data from the Hugging face seven wonder space that they have created,
and then index them in our database.
So now this is the data sets that I'm loading from the hugging face.
I'm printing the data here to learn how the data looks like.
So in this case here this is a document from Hugging Face.
It has a document ID and the content about the different wonders of the world.
Now I'll go ahead and index a document in memory document store.
So here we created an in-memory document store.
For that I will have to use the sentence transformer.
All mini LM model will download the model.
We'll embed the document with this embedder.
And then we'll write the document to the store.
Once it's embedded and then once the documents are embedded in the document store, we initialize it
with the in-memory retriever object.
You can either do this or you can create a pipeline out of this.
Whatever works best for you.
Now that we have the retriever ready, we need to build a retriever pipeline for our questions.
So for that we need a sentence transformer, text retriever, in-memory embedding retriever, and a
prompt builder.
So I have three different prompt components initialized in memory embedding retriever sentence transformer
text Embedder to embed questions.
This will help us fetch the top K document, and then prompt Builder would help construct the prompt
that our agent would eventually use.
So I created this pipeline seven Wonders Pipeline and added components text Embedder retriever and Prompt
Builder to the pipeline.
And then I'm connecting the pipeline as text Embedder to Retriever retriever to the prompt builder.
Now let's go to the next step here which is running the retrieval pipeline.
I'm running the Seven Wonders pipeline with text Embedder as the embedding component.
The question that I'm asking here is what does road Statue look like?
And then I'm printing the response.
Let me go ahead and run the code blocks that I might have missed in the video.
So we went through this.
There are a 151 documents that it wrote creating and initializing the components, adding it to the
pipeline.
and then running the pipeline.
So I did get the response here about the road statue.
Let's confirm how this looks like.
So here's the content that I got.
And if you notice here it is relevant to the road statue.
The next step is to create the tool with Seven Wonders pipeline.
So for that I have imported the Fast Drag Tools library with document with Image Query tool as a the
tool that I'll use here.
I'm giving the name as seven Wonders tool, and then the description is useful for when you need to
retrieve Fact of seven wonders.
It can give you information about one wonder per query.
Pass the wonder as input.
This is a very important step where it uses the name and the description of its functionality to decide
which tool to invoke.
Agent uses this information appropriately.
So please make sure that the description and the name is very relevant to the task.
And then this is the pipeline that we have specified up here.
Right.
Let's execute this okay.
So we got the seven wonder as a tool.
Ready.
Now let's go ahead and invoke this.
So here is the next piece of code that says seven wonder tool that we created up here.
Road statue is the input.
Then I get the tools result and then I'll print the response.
So we got the response.
And if you notice here we have the information about road statue and the details that we got from the
pipeline.
I went ahead and tried a different option for the pipeline.
In this case I wrote pyramid and it came back with the information of pyramid.
Now let's go ahead and use the generator to come up with the entire agent experience.
So here I have imported the agent and tools manager from the FastTrack.
Along with that, I am also importing the conversation Memory with the agent class.
Here, there's a generator.
There's a prompt template tool.
It is different in our case, which is seven wonders tool.
Conversation.
Memory.
We pass it to the generator and we run this.
How does road statue look like?
Let's execute this.
So the thought is I need to find out the appearance of the road statue.
It's using the tool seven wonder tool.
The input is road statue.
And then it gave us the response back from the pipeline.
And this is generating the response from the content.
Now what if we run two tools at the same time.
So in this case what we need to do is we need to add one more tool that we created in the previous video.
The tool was nutrition tool that we created in the previous video.
Let's go ahead and ask a question about how does Road Statue look like?
And the agent has two tools to evaluate and pick one.
Let's see if the agent can do justice to the tool's invocation.
So in this case, the user is asking for the appearance of the road statue.
Then it picked up seven Wonders tool, and we got all the information from the retrieval pipeline to
whatever we had before, and then it summarized it.
I will use another query.
How much protein does protein bar have?
And then execute this one more time.
So the thought is the protein content in the protein bar.
It invoked the nutrition tool and it invoked the necessary prompt with image.
It got the information from the content.
And then the final answer was that protein bar has 14g of protein.
That's amazing.
It was able to invoke the right tool to the right question that was asked.
I hope you learned Multiagent application with Multi-hop using React architecture.
Thank you and I'll see you in the next video.