WEBVTT

00:00.090 --> 00:03.750
-: The last part is to trace everything with LangSmith.

00:03.750 --> 00:06.930
And let's see everything we've learned beautifully displayed

00:06.930 --> 00:09.570
in the user interface of LangSmith.

00:09.570 --> 00:13.560
Go to .env and I'm going to paste my environment variables.

00:13.560 --> 00:16.263
The LangSmith display name is going to be ReAct.

00:20.520 --> 00:23.620
Now I'm going to simply run everything again

00:27.420 --> 00:29.250
and we got back the result.

00:29.250 --> 00:31.140
Now let's go to LangSmith

00:31.140 --> 00:34.353
and here we see, we have here the ReAct.

00:36.510 --> 00:38.700
And let's have a look on the tracing.

00:38.700 --> 00:41.160
So this is the first call to the LLM,

00:41.160 --> 00:43.380
and we can see that we took the ReAct prompt

00:43.380 --> 00:47.820
and we populated with our tools and our tools description

00:47.820 --> 00:50.250
and the question that we asked our agent,

00:50.250 --> 00:52.410
what is the length of the word dog?

00:52.410 --> 00:54.450
And in the answer we can see

00:54.450 --> 00:57.390
that I should get the text length function

00:57.390 --> 01:00.210
to determine the length of the word dog.

01:00.210 --> 01:04.080
So the action here is text length and dog.

01:04.080 --> 01:08.280
However, now let's see what our output parser did.

01:08.280 --> 01:11.940
So it received this, and as an output it gave us

01:11.940 --> 01:14.550
an object of type AgentAction.

01:14.550 --> 01:16.230
And we saw it already,

01:16.230 --> 01:19.140
which has the following keys and values.

01:19.140 --> 01:22.200
So it has in the tool field, get_text_length,

01:22.200 --> 01:25.440
which is the name of the function that we want to run.

01:25.440 --> 01:29.250
The tool input is dog, and you can see it right here.

01:29.250 --> 01:31.830
And the log over here is sort of a proof

01:31.830 --> 01:33.570
of how did langchain

01:33.570 --> 01:35.570
come up with this object of AgentAction.

01:36.480 --> 01:39.090
So we ran the tool, we got the result three,

01:39.090 --> 01:41.160
and now you can see that we added

01:41.160 --> 01:46.140
to our scratch pad over here that the observation was three.

01:46.140 --> 01:50.550
So this was after we ran the tool, we got the result.

01:50.550 --> 01:51.750
And this is the observation.

01:51.750 --> 01:56.370
And right now the LLM can actually determine

01:56.370 --> 01:58.140
the result and can determine

01:58.140 --> 01:59.880
what's the length of the word dog.

01:59.880 --> 02:02.497
So it now says, "I now know the final answer.

02:02.497 --> 02:03.630
"Final answer: 3."

02:03.630 --> 02:06.210
And we invoke the output parser again.

02:06.210 --> 02:08.220
So the output parer parses it

02:08.220 --> 02:10.680
and gives us an AgentFinish object,

02:10.680 --> 02:15.543
and its field of output is going to be three, and that's it.
