WEBVTT

00:00.000 --> 00:00.960
Presenter: I want to introduce you

00:00.960 --> 00:02.220
to a super useful place

00:02.220 --> 00:04.050
called The LangChainHub.

00:04.050 --> 00:07.626
It's supposed to be a single stop shop for sharing prompts,

00:07.626 --> 00:10.350
chains, agents, and more.

00:10.350 --> 00:14.640
So it's a repository for those prompts.

00:14.640 --> 00:16.412
Often the secret sauce

00:16.412 --> 00:19.790
for getting good results from the LLM is a high quality

00:19.790 --> 00:22.740
prompt without prompt engineering,

00:22.740 --> 00:26.610
and a lot of techniques that we discussed in this course,

00:26.610 --> 00:30.480
some of them in order to get more from the LLM.

00:30.480 --> 00:32.670
Now, the LangChainHub is a place

00:32.670 --> 00:34.860
where it offers a collection

00:34.860 --> 00:37.350
for commonly used prompts that people

00:37.350 --> 00:39.183
can share together and download.

00:40.320 --> 00:43.290
So I'm going to search for LangChainHub,

00:43.290 --> 00:47.550
and I'm going to click this URL and I'm here,

00:47.550 --> 00:49.710
and it's a part of LangSmith

00:49.710 --> 00:53.280
Notice that LangSmith is currently in beta version,

00:53.280 --> 00:55.380
so you can sign up for the beta.

00:55.380 --> 00:57.960
I'm not sure how fast the approvals are,

00:57.960 --> 01:01.980
but it's planned to be released soon.

01:01.980 --> 01:06.390
So we can see that here we have a repository

01:06.390 --> 01:08.790
of prompts that we're going to explore.

01:08.790 --> 01:11.400
So we can see that they're sorted by use case,

01:11.400 --> 01:13.620
whether we want prompts for agents,

01:13.620 --> 01:17.160
for autonomous agents, for classification tasks,

01:17.160 --> 01:20.370
for code writing, for anti extraction,

01:20.370 --> 01:23.310
for self-checking, SQL, you name it.

01:23.310 --> 01:25.740
All the common use cases are here,

01:25.740 --> 01:27.270
so we can filter them up.

01:27.270 --> 01:30.240
Now whether it's a model from Google, from Meta,

01:30.240 --> 01:34.560
from OpenAI, when working with models, we need

01:34.560 --> 01:37.740
to optimize for that specific model.

01:37.740 --> 01:39.930
And the same prompt that we wrote

01:39.930 --> 01:43.680
for model A may not be optimized for model B.

01:43.680 --> 01:47.595
So some model may accept words that are not accepted

01:47.595 --> 01:50.280
by other models, for example.

01:50.280 --> 01:54.990
So we need to optimize the prompts according to the vendor.

01:54.990 --> 01:56.910
Let's now explore some prompts.

01:56.910 --> 01:59.490
Let's focus on QA over documents.

01:59.490 --> 02:01.440
And let's take a look at the retrieval

02:01.440 --> 02:03.183
augmentation generation prompt.

02:04.470 --> 02:06.819
Now this piece of code shows how to use it

02:06.819 --> 02:08.490
and how to use this prompt.

02:08.490 --> 02:11.010
So we can see at the beginning we're loading the documents,

02:11.010 --> 02:13.530
splitting them, putting them in the vector store,

02:13.530 --> 02:17.460
and then we can see how we actually download this prompt.

02:17.460 --> 02:20.010
We use the hub.pull method,

02:20.010 --> 02:22.680
and we simply put this URL.

02:22.680 --> 02:25.800
Now you can see that the prompt variable is being passed

02:25.800 --> 02:30.030
to the retrieval QA chain in the chain type query arguments.

02:30.030 --> 02:33.540
So notice here you can change the actual prompt

02:33.540 --> 02:34.560
that is being called

02:34.560 --> 02:37.740
to the LLM augmenting the original prompt

02:37.740 --> 02:39.210
with any custom prompt.

02:39.210 --> 02:40.710
So this is very important.

02:40.710 --> 02:41.730
It can be customized.

02:41.730 --> 02:44.250
Right over here you can see the actual prompt

02:44.250 --> 02:46.860
and what parameters does it accept.

02:46.860 --> 02:48.570
And at the bottom you can see another

02:48.570 --> 02:50.880
example of how to use it.

02:50.880 --> 02:53.730
Something interesting is that

02:53.730 --> 02:56.670
in the right side you can see all the commits

02:56.670 --> 02:59.610
of how this prompt changed over time.

02:59.610 --> 03:01.710
And if you even want,

03:01.710 --> 03:04.353
and this is another view of the commits,

03:05.250 --> 03:07.260
and if we go back over here

03:07.260 --> 03:11.673
and let's take a look for other prompts,

03:15.210 --> 03:19.170
we can also sort by popularity, by top download.

03:19.170 --> 03:22.590
And you can see the number of downloads and likes

03:22.590 --> 03:24.300
and comments and

03:24.300 --> 03:25.860
how many people are watching whether

03:25.860 --> 03:27.600
this prompt is changing.

03:27.600 --> 03:30.120
So this is the React Chat example.

03:30.120 --> 03:33.223
So this is an agent based prompt.

03:33.223 --> 03:35.670
So it's for selecting tools.

03:35.670 --> 03:37.670
Now you can open it in the playground

03:37.670 --> 03:40.320
and you can plug in the parameters

03:40.320 --> 03:42.570
and see how this prompt behaves

03:42.570 --> 03:46.530
and what results do you get from it.

03:46.530 --> 03:48.510
So it's a easy tool,

03:48.510 --> 03:50.790
and very intuitive tool to use

03:50.790 --> 03:53.190
when experimenting with new prompts.

03:53.190 --> 03:56.670
So as you know, prompt engineering is a very big part

03:56.670 --> 03:59.100
of a writing an LLM application.

03:59.100 --> 04:01.290
So you can see how this prompt behaves

04:01.290 --> 04:04.620
with different vendors with different parameters

04:04.620 --> 04:08.643
of temperatures, lengths, and penalties, for example.
