WEBVTT

00:00.440 --> 00:01.040
Hey there.

00:01.080 --> 00:01.880
Eden here.

00:01.920 --> 00:04.720
I know the previous video was a long video.

00:05.040 --> 00:08.560
However, luckily for us, this video is much shorter.

00:08.840 --> 00:12.400
In this video, we'll be implementing the Reviser agent.

00:12.640 --> 00:18.840
Now, since we have most of the infrastructure ready, then all we need to do is to simply add an instruction

00:18.840 --> 00:21.840
to the prompt and create a new class for the response.

00:21.840 --> 00:22.760
And that's it.

00:22.960 --> 00:25.880
This agent will take the last artifact written.

00:25.920 --> 00:31.920
Use the critique in order to revise the artifact and then output us a better article.

00:33.000 --> 00:36.720
All right, so I'm going back to the code to change that.

00:37.400 --> 00:40.400
And we're going to add here a new template.

00:40.560 --> 00:42.840
Now those are the revision instructions.

00:42.840 --> 00:44.560
So let's take a look at them.

00:45.000 --> 00:48.200
Revise your previous answer using the new information.

00:48.240 --> 00:52.120
You should use the previous critique to add important information to your answer.

00:52.320 --> 00:57.520
You must include numerical citations in your revised answer to ensure it can be verified.

00:57.840 --> 01:03.640
Add a reference section to the bottom of your answer, which does not count towards the word limit in

01:03.640 --> 01:04.520
the form of.

01:04.560 --> 01:06.060
And then there are URLs.

01:06.300 --> 01:12.860
You should use the previous critique to remove superfluous information from your answer, to make sure

01:12.860 --> 01:15.460
it doesn't go over 250 words.

01:16.060 --> 01:24.540
So this instruction is going to be plugged in into our original actor prompt template in line number

01:24.580 --> 01:25.540
23.

01:25.540 --> 01:32.020
So in the placeholder of First Instruction we're going to plug in the revision instructions.

01:32.380 --> 01:34.580
Let's head up to schema.py.

01:34.940 --> 01:38.900
We want now to create a new class for our revisited answer.

01:39.140 --> 01:41.220
And we'll call it Revise answer.

01:41.420 --> 01:45.020
And notice it will inherit from the answer creation class.

01:45.220 --> 01:48.260
So this means it will have all of its fields.

01:48.260 --> 01:51.260
So it will have answer reflection search queries.

01:51.460 --> 01:54.460
However it will have also something else.

01:54.660 --> 02:00.460
It will also have the references field which is going to be a list of strings.

02:00.460 --> 02:07.340
And those strings are going to be citations of URLs mostly that we'll get from the search engine.

02:07.700 --> 02:11.880
Now we haven't discussed what's going to happen with the search engine and how it's going to work.

02:11.880 --> 02:14.480
Don't worry, we're going to do it in the next video.

02:14.840 --> 02:17.320
Alrighty, let's head back to Chains pie.

02:17.560 --> 02:20.920
And now we want to write the revision chain.

02:21.160 --> 02:27.080
So after we wrote the revision instructions then we simply want to create a new chain very similar to

02:27.120 --> 02:28.160
what we did before.

02:28.560 --> 02:30.840
And we'll take the actor prompt template.

02:30.880 --> 02:37.680
We'll fill up the first instruction placeholder with the revised instructions variable, and we simply

02:37.680 --> 02:43.640
want to pipe it into our LM, GPT four turbo again using function calling.

02:43.640 --> 02:47.280
So we'll supply the tools which is the revised answer tool.

02:47.560 --> 02:51.200
And we're going to give the tool choice to be revised answer.

02:51.200 --> 02:57.840
So this would enforce the schema of the pedantic object revise answer class and would de facto make

02:57.840 --> 03:02.200
our LM adhere and grab the answer to be that kind of object.

03:03.040 --> 03:05.560
So let's also import that from schemas.

03:06.360 --> 03:10.160
And we can see in line 15 we also imported it.

03:10.400 --> 03:11.920
And that's it for the reviser.

03:11.920 --> 03:16.210
So this is the logic which is going to run in the revision node.

03:16.850 --> 03:17.650
Alrighty.

03:17.650 --> 03:22.610
So let's have a recap of what we did so far in this video with the revision node.

03:22.650 --> 03:29.930
We wrote the Revisor chain, and in the revision step or Revisor node, we're going to take the result

03:29.930 --> 03:35.970
we got from the search engine from Tavli with the relevant search queries, and that we're going to

03:36.010 --> 03:42.010
plug in into our already existing article alongside with the generated critique.

03:43.210 --> 03:49.690
And the agent is going to revise the response projected from the critique that was already written,

03:49.930 --> 03:55.970
is going to take the search results from Tavli, and it's going to add this into our response.

03:55.970 --> 04:02.050
And of course, it's going to citate in all the resources that we used from the internet.

04:03.210 --> 04:11.210
In the next video, we'll be dealing with the tool executions, and we'll handle all of the tavli web

04:11.250 --> 04:16.890
searching for relevant topics, and we're going to propagate that into our revisited answer.
