WEBVTT

00:00.000 --> 00:02.520
-: In this video, we're gonna cover a concept

00:02.520 --> 00:05.340
inside of LangSmith called LangChain Hub.

00:05.340 --> 00:08.550
LangChain Hub is a prompt resource

00:08.550 --> 00:11.220
which allows you to explore different types of prompts

00:11.220 --> 00:13.590
that other prompt engineers have made.

00:13.590 --> 00:15.240
Let's have a look at some of the different types

00:15.240 --> 00:17.850
of things you can do inside of LangChain Hub.

00:17.850 --> 00:18.900
One thing, for example,

00:18.900 --> 00:22.170
is to browse the hubs by a point of interest.

00:22.170 --> 00:23.550
Another thing that you might decide

00:23.550 --> 00:25.680
to do is try out specific prompts

00:25.680 --> 00:27.720
in the playground inside of LangSmith.

00:27.720 --> 00:29.070
Let's have a look in LangSmith

00:29.070 --> 00:30.810
at all these types of use cases.

00:30.810 --> 00:33.780
If you go into LangSmith, and then as well as that,

00:33.780 --> 00:36.390
what we're gonna do is click on the world symbol,

00:36.390 --> 00:38.730
which then takes us into LangChain Hub.

00:38.730 --> 00:40.530
Now inside LangChain Hub, there's a range

00:40.530 --> 00:42.410
of different types of prompts and use cases.

00:42.410 --> 00:44.550
So if you're interested in, for example,

00:44.550 --> 00:46.440
chatbots and code understanding,

00:46.440 --> 00:48.750
we can see that these are the types of prompts

00:48.750 --> 00:51.630
that have seen a lot of resurgence in those.

00:51.630 --> 00:53.280
Now, I can click on a prompt.

00:53.280 --> 00:55.740
Now, I can see this is the Readme of the prompt,

00:55.740 --> 00:58.380
and like how you would potentially use this.

00:58.380 --> 00:59.910
We can also have a look at

00:59.910 --> 01:02.280
how regularly they commit their prompt.

01:02.280 --> 01:04.890
Things you can do is if you go into the top right,

01:04.890 --> 01:06.540
we can say try it,

01:06.540 --> 01:09.030
and then we can also then do a run

01:09.030 --> 01:11.070
by entering in some variables.

01:11.070 --> 01:13.470
So you can, you know, put in some variables here

01:13.470 --> 01:15.660
and you could run specific types of prompts

01:15.660 --> 01:17.070
by clicking start.

01:17.070 --> 01:20.220
And you'll see it's asking for an OpenAI key.

01:20.220 --> 01:23.310
So obviously then you would need to set your secret key

01:23.310 --> 01:26.430
up in the OpenAI key in the top right.

01:26.430 --> 01:28.410
So this is a way where you can see the template,

01:28.410 --> 01:30.270
you can see what is being sent.

01:30.270 --> 01:32.010
You can also edit the template.

01:32.010 --> 01:33.270
So as we scroll down here,

01:33.270 --> 01:34.860
you can see these are the variables

01:34.860 --> 01:37.350
and we can also edit the template in real-time.

01:37.350 --> 01:38.880
You've got other things like being able

01:38.880 --> 01:41.760
to copy the clipboard, delete messages.

01:41.760 --> 01:43.590
We can also move messages around.

01:43.590 --> 01:45.660
So it's possible for us to really play around

01:45.660 --> 01:48.390
inside this little prompt playground.

01:48.390 --> 01:50.790
And we can also save our own prompts

01:50.790 --> 01:52.740
and give it a repository name.

01:52.740 --> 01:55.320
So you can play a lot around in the prompt playground.

01:55.320 --> 01:56.400
Let's actually switch gears

01:56.400 --> 01:58.440
and have a look inside of a Jupyter Notebook.

01:58.440 --> 02:02.130
So what we're gonna do is install Faiss and LangChain Hub.

02:02.130 --> 02:05.040
And then I'm just gonna go and connect to LangChain Hub.

02:05.040 --> 02:08.250
And I'm gonna pull down several different prompts.

02:08.250 --> 02:10.710
If you're looking specifically for the prompts,

02:10.710 --> 02:11.820
if you go on a prompt

02:11.820 --> 02:13.890
and you scroll right down to the bottom,

02:13.890 --> 02:15.810
you'll see this is how you import it.

02:15.810 --> 02:20.430
So it shows you exactly how to import that specific prompt.

02:20.430 --> 02:23.610
Now, we can have a look at some of these prompts.

02:23.610 --> 02:24.780
The one that I'm specifically

02:24.780 --> 02:26.760
interested in is this RAG prompt,

02:26.760 --> 02:30.210
which RAG stands for Retrieval Augmented Generation.

02:30.210 --> 02:31.980
So what we're gonna do is we're gonna follow along

02:31.980 --> 02:33.990
with the example that it's given us.

02:33.990 --> 02:35.550
And just to highlight this,

02:35.550 --> 02:37.650
depending upon the different types of prompts you get.

02:37.650 --> 02:42.120
So I'm gonna go into RAG prompt LangChain Hub.

02:42.120 --> 02:44.400
And then what I'm gonna do is look at this prompt.

02:44.400 --> 02:46.860
And this person's given a common usage

02:46.860 --> 02:48.450
for this specific type of prompt,

02:48.450 --> 02:49.410
which is really, really nice.

02:49.410 --> 02:51.330
So just straight from their repo,

02:51.330 --> 02:54.270
we can already start to get a lot of information.

02:54.270 --> 02:57.810
So we're gonna use a web-based loader, get that webpage,

02:57.810 --> 03:01.770
split the document into individual small documents,

03:01.770 --> 03:03.360
make embeddings from those,

03:03.360 --> 03:04.830
and store those in a vector store.

03:04.830 --> 03:07.050
Then we're gonna pull the RAG prompt.

03:07.050 --> 03:10.440
And then we're gonna set up a retrieval Q&amp;A chain

03:10.440 --> 03:12.330
with a chat OpenAI.

03:12.330 --> 03:14.940
And then we're gonna pass at the LLM, the retriever,

03:14.940 --> 03:18.210
and the chain type args passing in the prompt.

03:18.210 --> 03:19.043
And then we're gonna say,

03:19.043 --> 03:21.420
what are the approaches to task decomposition?

03:21.420 --> 03:23.550
And then we're gonna pass that chain in with the query

03:23.550 --> 03:25.590
and the question and then return the result.

03:25.590 --> 03:29.160
So I think the important thing is LangChain Hub gives you

03:29.160 --> 03:30.540
a lot of flexibility in seeing

03:30.540 --> 03:32.790
what other prompt engineers have created

03:32.790 --> 03:34.620
to solve similar types of problems.

03:34.620 --> 03:36.450
You can easily pull down their prompts using

03:36.450 --> 03:38.010
the LangChain Hub package.

03:38.010 --> 03:39.990
Hopefully, this gives you a good insight

03:39.990 --> 03:42.090
and introduction into using LangChain Hub.
