This lecture is going to be the most important lecture in this entire course.
Why?
Because we are going to cover prompt engineering.
Prompt engineering can make or break your AI voice agent.
Consider prompts like brain of our LLM or brains of our AI voice agent.
If you provide with enough context, enough knowledge and enough information, the success ratio or
the response of our AI voice agent will be top notch.
That's why I make sure to watch this lecture till the end.
And even if you have any concerns or questions, you can always rewatch or always come back to this
video because we are going to cover everything, everything about prompt engineering.
And no, it is not a YouTube video.
It is not the best ChatGPT prompt or ChatGPT prompt thing.
No, we are going to start with the fundamentals, and then we are going to write our fully and best
prompts that you can write for your AI voice agent.
So let us get started.
First of all, it is important to know what is prompt engineering.
Prompt engineering is the art of crafting effective instruction.
I will repeat crafting effective instructions for our AI agent, and they directly influence the performance
and reliability of our agents.
This class will teach you how to write clear, concise, and actionable prompts that will empower your
AI voice agent to maximum.
Prompt Engineering is very crucial from AI agents, because it determines how effectively the AI interprets
and responds to the user queries or task.
Well crafted prompts guides the AI to produce accurate, relevant, and context sensitive outputs,
while on the other hand, poor promises can lead to ambiguity or incorrect results limiting our AI
agents capability.
I am not promising any guarantees here, saying that you have to write just one prompt and it will be
final touch.
No, you always have to reiterate, or we always have to refine our entire AI prompt until we find that
sweet spot or the success ratio that we are looking.
So we have divided brainstorming our prompt into four different sections.
The first is design.
Second is test.
Third is refined and forth is
Repeat.
Before you start writing your prompt, you should have a like a wireframe or design of your entire system
or entire set of tasks that you want your voice agent to do.
That's why design part is so important before you start writing your prompts.
So when you are designing, start with your initial prompt.
Consider like specific task, context and the desired outcome you want.
Clear and detailed prompts will help you to understand your needs and requirements.
Second part of this process is testing our AI voice agent.
Once we see how they perform and what are the responses, we can easily evaluate if they are meeting
our needs and our consideration.
By testing, we can easily identify potential gaps in clarity or our structure of the prompt.
Now it's time to refine.
Based on the results of the test, we can adjust the prompt to improve the response.
This might involve rewording your entire prompt, adding more context, or small minor things that you
want your AI agent to do.
Feel free to add it in the prompt here.
Last thing I want to say is there is no final prompt here.
We will always repeat by testing, by refining and making further adjustments as needed.
Alright, I hope you understand the process which was designed.
Test, refine and repeat.
Now let us come back to our four building blocks which were identity style, response, guidance and
task and goals.
First of all, identity is obvious.
We need to define a persona or role to our ai voice agent and specific tones for any interaction with our
user.
Second is style.
For example, we want our AI voice agent to be humorous, formal, or consciousness.
We can all feed this information and the style section.
Third building block is again very important, which is response guidance.
We can also specify question limits! how many questions our AI agent should ask during the call, like
one question at a time, or combine two questions and ask it in one go or something like it.
Lastly, we have task and goals.
We need to give our AI voice agent objective or the end goals that we that we want to achieve from it.
Why not let us take an example and understand it in much better way?
So this time, let us take an example of travel assistant, because we have used the dental one so many times.
So let us refresh with a new one.
First off, we have got what we call identity section.
It is pretty simple.
We are just telling our AI- hey, you are travel booking assistant.
You know, like when you start a new job and they tell you what is your role or what is
your job here?
This is as simple.
Just give identity like hey, do this, do that.
You are this, you are that.
This helps the AI to understand what exactly it is supposed to do.
Second, we have style section.
Think of it like when you are giving someone tips before they start their first day at a job.
We are doing exactly the same here.
We are saying here that give complete information but do not ramble.
Be professional and polite, but keep it brief because people are listening and not reading.
You are operating as voice, phone or voice conversation and not a newsletter.
Third, we have the response guidance and it's time to get into the nitty gritty details of our messaging.
Like when we are talking about dates.
Say them clearly January 15th instead of 1/15.
And here's a cool tip we will tell our AI to only offer three options max.
Why?
Because imagine someone telling you ten different package options over a phone.
Your head won't be spinning, you will instantly be confused, and your head will be spinning.
And you will cut the call right over there.
Finally, we have the task section.
This is basically the step by step guidance for our conversation.
Start by saying hey and ask them where they want to go.
Then find out which place they want to travel and what are they looking for?
Check what's available and show them the best options.
Pretty straightforward, like following a recipe in order to cook an amazing dish.
Look, the whole thing here worked together like a proper well oiled machine.
Each part has its purpose.
And when they all come together, you get an AI that can handle travel bookings smoothly and naturally
even better than a human.
You might ask why we are doing this, why we are dividing our entire product into those four basic building
blocks.
Let me tell you why.
Because it will make our prompt reusable, easier to maintain, and easier for our or our voice agents
to understand and comprehend when writing prompts.
It is important to break down the prompts into smaller sections, where each section has its own focus
like identity, style, guidance and task and goal.
This has a couple of added benefits.
I will repeat those advantages.
The first is our prompt will become reusable.
Second is our prompt will be easier to maintain.
And the third is it is easier for our LLM to understand why.
Reusable.
Let's say our prompt is for travel agent.
Right.
And we want to reuse it for dental niche or any niche that you want.
All you need to do is change some specific identity.
Change some specific tasks.
Apart from that, everything else is still the same.
So it is reusable, then it is easier to maintain.
So if your problem is not solving some specific problem, we can easily figure out which section is
missing or which section has certain gaps that we can solve.
Now let us explore some hacks and tips that we can instantly use to level up our AI agent responses
significantly.
I am in the last building block which was tasked in goals will be the always one.
You have to come back, refine and reiterate.
The first three building blocks were generic and basic, and you can do it right on your own or in one
shot.
But task and goals will be the always one you have to come back.
During a call,
If you want your AI agent to follow a specific roadmap or a specific procedure to lead the conversation,
I recommend writing the task as steps.
This will help LLM or our AI voice agent
Understand what to ask at each step and how to proceed.
You can have some logic in the steps as well.
This will ensure that our AI agent does not pack all the questions in one go.
For example, we are asking for 1. Which is the user's name.
Then we are asking if the user needs a refund or just a replacement, or just want to retrieve information
if the user needs a replacement.
Transition to replacement state.
As you can see, we are attaching specific tasks and goals.
We need to follow in proper format and in proper sequence.
Last, we are just saying that if the user is just retrieving information.
As for the order number.
Now sometimes you might notice our voice agent will continue on speaking and will not stop the call,
for example.
First it will ask for user's name and then directly it will shift to the next question, which is ask
for refund or replacement.
So in order to stop that, or in order to prevent that, we can write line like.
Wait for the user response.
So we are explicitly mentioning to our agent to first get the user response and then move to the next
steps.
Similarly, in the third and the fourth task, which is wait for the user response so it will take a
stop.
It will listen to the user response and then proceed forward.
We can tell our AI agent to add a pause or read slowly when speaking any number or date directly in
the prompt.
Let me show you how.
Although you can adjust the general speed of your AI voice agent by changing the voice setting.
But if you need your AI voice agent to slow down at specific points or specific conversation, you can
do it like reading phone numbers or reading dates.
You can easily add hyphen in between the numbers.
For example, the number is 2134, so it will take pause like this.
And it will not just remember like 23413412.
It will run.
When we are adding that hyphen, it will take a pause.
2-1-3-4.
So that the user on the other side can easily hear and easily can jot down the number.
Now, if you want to add long pauses, you can do that by adding multiple hyphens between the numbers.
Or if you want to speak phone numbers in a specific way or a specific format like three, three, three
or like plus one and then country code and then the number formatting like it should speak in a bunch
of three numbers, then three, then three.
You can easily do that as well in prompts.
Let's suppose when people ask for our phone number, this is our phone number.
So we are providing under this guidance section.
When speaking the phone number, transfer the format as follows.
Input format like our entire number into three three.
Hyphen three should be pronounced like 415 inverse.
Did you see we are not just typing numbers in the prompt, we are converting them to words and letters.
Lastly, we are saying do not omit the space around the dash when speaking the dash.
Here is the hyphen.
So as you can remember, the hyphen is all about the pause.
So we are telling our agent to take a pause.
There is 415 back to the center again.
My phone number is 41589233245, and I am sure it's 4158920 agent, if it is following this specific
format or not like 333, my phone number is (415) 892-3245.
Can you say that again?
Sure.
It's (415) 892-3245.
My phone number is four one.
Yeah.
Thank you very much.
Also, if you want your voice to use backchannel words like "yeah" "okay" "I see", you can enable that option
as well inside that function call.
Now let's say you want your voice agent to does not give any response.
You can easily do that in prompt as well.
For example, reply exactly the following.
No response needed.
So our LLM or response generation will stop right over there.
You can also include fallback and error handling inside the prompt.
This will ensure that your agent can gracefully handle unexpected user inputs or system errors.
For example, you can write if the customer's response is unclear.
Ask clarifying question, you can ask back.
If you encounter any issue, inform the customer politely and ask to repeat.
For example, if our voice agent was not able to get the correct email address or the phone number.
It will ask the user back rather than installing the wrong email or wrong phone number in the database.
Now here are some additional hacks or tips.
Iterate as much as possible on your prompt.
AI is driven by experimentation and iteration.
It is not perfect.
Trust me, AI is not perfect.
Without refining or reiterating on your prompt, you will not get that voice agent that you are looking
for.
So again, iterate as much as possible on your prompt.
You can also write your prompt in markdown formatting.
You can see our entire code was in markdown formatting.
Why?
Because markdown formatting is a language of they understand it better rather than just generic and
simple English.
And if you ask me, markdown formatting is very easy.
Like it is very neat, clear and concise and easier for our LLM to understand and comprehend our actions
and steps.
You can also do emotional prompting to your voice agent.
Let me give you an example.
So instead of saying tell me a story, you can say, can you tell me a cozy bedtime story?
That warm and comforting.
This will guide our AI to respond to that intended mood or intended tone.
Not to forget to add voice realization to your.
I see people like us do not speak like fluently.
For example, I don't speak fluently.
Like I will say ah ah ah ah.
Sorry sorry sorry.
Okay, so you can add those type of specific words to your voice agent very easily inside your prompt.
Let me show you how you can add stuttering, like use repeated letters or sounds like I don't know.
No, no, wait, wait or wait a second.
You can also add hesitation like um.
Ah, well, you know, I was thinking about this.
You can also add emotional emphasis, like you can use capital letters, exclamation marks or multiple
of dots to reflect the tone or dramatic pauses.
For example, I cannot.
I cannot just believe it or.
Well, that's all I guess.
Congratulations, guys.
You are now certified prompt engineer.
You don't have to go anywhere.
You don't have to go any other lecture or any other course.
You are now.
If you are watching this lecture, you are certified Prompt engineer because you can now speak in the
same language with AI or LLMs.
This is the bonus gift I want to give you if you are still watching this lecture.
So this is an example of the best prompt that we have built, and we are running for our clients as
well as inside our agency.
So take a look through like what are the building blocks?
What are the four sections that we have divided and what a specific task, what a specific like emotional
pauses, hyphens and everything that we are using in this prompt.
That's all from my side and I will see you in the next lecture, but I will attach another prompt,
Engineering Examples and Guides in the resource section.
So make sure to check it out.
Bye bye.
And there goes the balloon.
I guess I cannot see this that's why..
Byee!