WEBVTT

00:01.410 --> 00:02.730
-: Hi, this is Jared Zoneraich.

00:02.730 --> 00:05.370
I am one of the co-founders of PromptLayer,

00:05.370 --> 00:08.220
and we are a platform for prompt engineering.

00:08.220 --> 00:09.300
So as you might guess,

00:09.300 --> 00:11.100
prompt engineering is really important to us,

00:11.100 --> 00:13.650
and we believe it should be for you too.

00:13.650 --> 00:16.920
So this video, I'm gonna talk a little bit

00:16.920 --> 00:18.480
about organizing your prompts,

00:18.480 --> 00:23.480
and how to effectively iterate and version and manage them.

00:24.180 --> 00:26.460
I think it's, I think this is a really important topic,

00:26.460 --> 00:30.540
because the prompts, whether you're a individual hacker,

00:30.540 --> 00:32.910
or, especially, if you're a collaborative team,

00:32.910 --> 00:35.730
the prompts are your goal, the prompt's your IP,

00:35.730 --> 00:36.840
the prompts are the magic

00:36.840 --> 00:39.600
that makes your system work quite literally, right?

00:39.600 --> 00:40.433
And

00:41.755 --> 00:43.800
you need to manage them well.

00:43.800 --> 00:46.230
You would do it like your code base,

00:46.230 --> 00:48.000
it's very important that it's organized.

00:48.000 --> 00:50.730
So I'm gonna show you a feature

00:50.730 --> 00:52.530
in PromptLayer called snippets,

00:52.530 --> 00:54.930
which is basically a way to compose templates

00:54.930 --> 00:59.310
from other templates and help keep everything organized.

00:59.310 --> 01:02.250
So let's just create a normal prompt first.

01:02.250 --> 01:05.940
We'll call this ai-medical-professional.

01:05.940 --> 01:07.447
So this will be like a AI doctor.

01:07.447 --> 01:09.990
"You are an AI doctor.

01:09.990 --> 01:11.560
Help the user

01:12.510 --> 01:14.610
understand,

01:14.610 --> 01:18.720
help the user with any guidance you can give."

01:18.720 --> 01:20.040
All right, this is pretty good.

01:20.040 --> 01:23.850
We'll add a user question here.

01:23.850 --> 01:25.050
Input variable there.

01:25.050 --> 01:27.817
Let's save this, first commit.

01:27.817 --> 01:29.100
(mouse button clicking)

01:29.100 --> 01:30.750
All right, perfect.

01:30.750 --> 01:33.780
I think we could make this a little bit better though.

01:33.780 --> 01:38.040
Let's just edit this again, I have a little snippet of text,

01:38.040 --> 01:39.990
actually, I think ChatGPT wrote this for me,

01:39.990 --> 01:42.630
but basically explains the medical system.

01:42.630 --> 01:43.800
And I think this is relevant,

01:43.800 --> 01:47.040
because you don't want the doctor saying anything crazy.

01:47.040 --> 01:49.140
You want them to behave with HIPAA.

01:49.140 --> 01:52.976
So let's call this hipaa explanation.

01:52.976 --> 01:54.700
(keyboard keys clicking)

01:54.700 --> 01:55.533
(mouse button clicks)

01:55.533 --> 01:57.492
All right, so now we have a good prompt.

01:57.492 --> 02:00.090
Let's open up in the playground and see how it goes.

02:00.090 --> 02:04.260
We'll say, "My stomach feels weird.

02:04.260 --> 02:07.018
What could it be?"

02:07.018 --> 02:07.851
(mouse button clicks)

02:07.851 --> 02:11.070
So we can GPT-3, yep, that all sounds good.

02:11.070 --> 02:12.240
So let's run this.

02:12.240 --> 02:14.370
So as we're running this, basically,

02:14.370 --> 02:15.720
I'm just, wanna test it out.

02:15.720 --> 02:17.460
I wanna get a good example,

02:17.460 --> 02:20.040
and maybe we can put a few shot example here.

02:20.040 --> 02:23.280
All right, so that wasn't that good,

02:23.280 --> 02:25.650
but let's copy and paste this and let's go back

02:25.650 --> 02:26.940
to our prompt.

02:26.940 --> 02:30.399
And we could say, "My stomach feels weird."

02:30.399 --> 02:32.070
(keyboard keys clicking)

02:32.070 --> 02:34.980
So we're adding a few shot example in here.

02:34.980 --> 02:36.120
So I didn't like this.

02:36.120 --> 02:38.223
So let's take out that first sentence,

02:39.600 --> 02:40.433
and

02:41.317 --> 02:43.470
let's just give it the answer.

02:43.470 --> 02:46.710
I don't want it to say, "I'm not a doctor, whatever."

02:46.710 --> 02:48.060
All right, so, oh,

02:48.060 --> 02:50.973
we wanna add the input variable here.

02:52.230 --> 02:53.063
Great, okay.

02:53.063 --> 02:57.390
So we have a prompt, call it few shot.

02:57.390 --> 03:00.330
Now that we have our prompt, how do we keep this organized?

03:00.330 --> 03:02.340
Well, there's a few things we can take out

03:02.340 --> 03:04.320
into modular components.

03:04.320 --> 03:06.480
Let's first take out this preamble.

03:06.480 --> 03:10.980
So I'm gonna create a new prompt template in PromptLayer.

03:10.980 --> 03:13.560
I'm gonna use the completion text so we can use it

03:13.560 --> 03:15.300
as a snippet and not chat.

03:15.300 --> 03:18.480
So we'll call this hippa,

03:18.480 --> 03:20.910
oh, what is it?

03:20.910 --> 03:25.910
It's two As, I'm not a doctor, and we'll call it preamble.

03:26.400 --> 03:27.650
Then we'll paste this in.

03:29.370 --> 03:30.203
Let's just save it.

03:30.203 --> 03:32.520
We don't need a commit message here.

03:32.520 --> 03:36.480
And then I say we can add this answer as well.

03:36.480 --> 03:38.820
We can also separate that out.

03:38.820 --> 03:41.796
Let's call it few shot answer.

03:41.796 --> 03:45.570
(mouse button clicking)

03:45.570 --> 03:48.180
So now that we have those three templates,

03:48.180 --> 03:50.880
let's go back to our main template.

03:50.880 --> 03:53.700
So this is the master template, and let's swap them in,

03:53.700 --> 03:56.400
and we can, I don't know if you saw that.

03:56.400 --> 03:58.200
All I did is I pressed the @ symbol,

03:58.200 --> 04:00.150
and now we can see a snippet,

04:00.150 --> 04:03.270
and we can add this hipaa preamble.

04:03.270 --> 04:05.433
And then let's do the same thing here,

04:06.360 --> 04:08.703
and we'll add the few shot answer,

04:09.750 --> 04:13.353
and then let's call it snippets in our commit message.

04:14.340 --> 04:16.350
All right, now, this looks so much cleaner.

04:16.350 --> 04:18.600
We can still open the playground and see the whole thing,

04:18.600 --> 04:19.890
and play around with it,

04:19.890 --> 04:22.143
but we can also click on one of these.

04:23.280 --> 04:24.930
All right, well, hope this is useful.

04:24.930 --> 04:27.210
This is a good way to delegate responsibilities

04:27.210 --> 04:30.510
between your team and just make sure nothing

04:30.510 --> 04:31.770
screws up your whole system.

04:31.770 --> 04:35.130
And maybe I wanna use this hipaa preamble in 10 different

04:35.130 --> 04:36.270
ones of my prompts.

04:36.270 --> 04:37.410
This makes it super helpful.

04:37.410 --> 04:38.970
So this is a good strategy,

04:38.970 --> 04:40.890
whether you're using Prompt Layer or not.

04:40.890 --> 04:44.343
I highly recommend composing your templates.
