-: Hi, this is Jared Zoneraich.
I am one of the co-founders of PromptLayer,
and we are a platform for prompt engineering.
So as you might guess,
prompt engineering is really important to us,
and we believe it should be for you too.
So this video, I'm gonna talk a little bit
about organizing your prompts,
and how to effectively iterate and version and manage them.
I think it's, I think this is a really important topic,
because the prompts, whether you're a individual hacker,
or, especially, if you're a collaborative team,
the prompts are your goal, the prompt's your IP,
the prompts are the magic
that makes your system work quite literally, right?
And
you need to manage them well.
You would do it like your code base,
it's very important that it's organized.
So I'm gonna show you a feature
in PromptLayer called snippets,
which is basically a way to compose templates
from other templates and help keep everything organized.
So let's just create a normal prompt first.
We'll call this ai-medical-professional.
So this will be like a AI doctor.
"You are an AI doctor.
Help the user
understand,
help the user with any guidance you can give."
All right, this is pretty good.
We'll add a user question here.
Input variable there.
Let's save this, first commit.
(mouse button clicking)
All right, perfect.
I think we could make this a little bit better though.
Let's just edit this again, I have a little snippet of text,
actually, I think ChatGPT wrote this for me,
but basically explains the medical system.
And I think this is relevant,
because you don't want the doctor saying anything crazy.
You want them to behave with HIPAA.
So let's call this hipaa explanation.
(keyboard keys clicking)
(mouse button clicks)
All right, so now we have a good prompt.
Let's open up in the playground and see how it goes.
We'll say, "My stomach feels weird.
What could it be?"
(mouse button clicks)
So we can GPT-3, yep, that all sounds good.
So let's run this.
So as we're running this, basically,
I'm just, wanna test it out.
I wanna get a good example,
and maybe we can put a few shot example here.
All right, so that wasn't that good,
but let's copy and paste this and let's go back
to our prompt.
And we could say, "My stomach feels weird."
(keyboard keys clicking)
So we're adding a few shot example in here.
So I didn't like this.
So let's take out that first sentence,
and
let's just give it the answer.
I don't want it to say, "I'm not a doctor, whatever."
All right, so, oh,
we wanna add the input variable here.
Great, okay.
So we have a prompt, call it few shot.
Now that we have our prompt, how do we keep this organized?
Well, there's a few things we can take out
into modular components.
Let's first take out this preamble.
So I'm gonna create a new prompt template in PromptLayer.
I'm gonna use the completion text so we can use it
as a snippet and not chat.
So we'll call this hippa,
oh, what is it?
It's two As, I'm not a doctor, and we'll call it preamble.
Then we'll paste this in.
Let's just save it.
We don't need a commit message here.
And then I say we can add this answer as well.
We can also separate that out.
Let's call it few shot answer.
(mouse button clicking)
So now that we have those three templates,
let's go back to our main template.
So this is the master template, and let's swap them in,
and we can, I don't know if you saw that.
All I did is I pressed the @ symbol,
and now we can see a snippet,
and we can add this hipaa preamble.
And then let's do the same thing here,
and we'll add the few shot answer,
and then let's call it snippets in our commit message.
All right, now, this looks so much cleaner.
We can still open the playground and see the whole thing,
and play around with it,
but we can also click on one of these.
All right, well, hope this is useful.
This is a good way to delegate responsibilities
between your team and just make sure nothing
screws up your whole system.
And maybe I wanna use this hipaa preamble in 10 different
ones of my prompts.
This makes it super helpful.
So this is a good strategy,
whether you're using Prompt Layer or not.
I highly recommend composing your templates.