Hey there.
Eden here.
I know the previous video was a long video.
However, luckily for us, this video is much shorter.
In this video, we'll be implementing the Reviser agent.
Now, since we have most of the infrastructure ready, then all we need to do is to simply add an instruction
to the prompt and create a new class for the response.
And that's it.
This agent will take the last artifact written.
Use the critique in order to revise the artifact and then output us a better article.
All right, so I'm going back to the code to change that.
And we're going to add here a new template.
Now those are the revision instructions.
So let's take a look at them.
Revise your previous answer using the new information.
You should use the previous critique to add important information to your answer.
You must include numerical citations in your revised answer to ensure it can be verified.
Add a reference section to the bottom of your answer, which does not count towards the word limit in
the form of.
And then there are URLs.
You should use the previous critique to remove superfluous information from your answer, to make sure
it doesn't go over 250 words.
So this instruction is going to be plugged in into our original actor prompt template in line number
23.
So in the placeholder of First Instruction we're going to plug in the revision instructions.
Let's head up to schema.py.
We want now to create a new class for our revisited answer.
And we'll call it Revise answer.
And notice it will inherit from the answer creation class.
So this means it will have all of its fields.
So it will have answer reflection search queries.
However it will have also something else.
It will also have the references field which is going to be a list of strings.
And those strings are going to be citations of URLs mostly that we'll get from the search engine.
Now we haven't discussed what's going to happen with the search engine and how it's going to work.
Don't worry, we're going to do it in the next video.
Alrighty, let's head back to Chains pie.
And now we want to write the revision chain.
So after we wrote the revision instructions then we simply want to create a new chain very similar to
what we did before.
And we'll take the actor prompt template.
We'll fill up the first instruction placeholder with the revised instructions variable, and we simply
want to pipe it into our LM, GPT four turbo again using function calling.
So we'll supply the tools which is the revised answer tool.
And we're going to give the tool choice to be revised answer.
So this would enforce the schema of the pedantic object revise answer class and would de facto make
our LM adhere and grab the answer to be that kind of object.
So let's also import that from schemas.
And we can see in line 15 we also imported it.
And that's it for the reviser.
So this is the logic which is going to run in the revision node.
Alrighty.
So let's have a recap of what we did so far in this video with the revision node.
We wrote the Revisor chain, and in the revision step or Revisor node, we're going to take the result
we got from the search engine from Tavli with the relevant search queries, and that we're going to
plug in into our already existing article alongside with the generated critique.
And the agent is going to revise the response projected from the critique that was already written,
is going to take the search results from Tavli, and it's going to add this into our response.
And of course, it's going to citate in all the resources that we used from the internet.
In the next video, we'll be dealing with the tool executions, and we'll handle all of the tavli web
searching for relevant topics, and we're going to propagate that into our revisited answer.