0% found this document useful (0 votes)
2 views

PromptEngineeringPRO

The document provides eight tips for writing effective prompts for GPT models to achieve desired outputs. Key strategies include offering context, providing examples, defining expected formats, and giving GPT a specific role. By refining prompts through testing and including helpful information, users can enhance the performance of AI in various tasks.

Uploaded by

ricardo.comtrel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

PromptEngineeringPRO

The document provides eight tips for writing effective prompts for GPT models to achieve desired outputs. Key strategies include offering context, providing examples, defining expected formats, and giving GPT a specific role. By refining prompts through testing and including helpful information, users can enhance the performance of AI in various tasks.

Uploaded by

ricardo.comtrel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

How to write an

effective GPT
prompt
8 GPT prompt tips to help get the output you're looking
for.
By Reid Robinson · June 14, 2024

GPT

—a family of AI models built by OpenAI—can

tell bad jokes

and write hilarious poems about your life, but it can also help you do your
job better. The catch: you need to help it do its job better, too.
Do more with ChatGPT

Discover more ways to add AI to your workflows.

Explore now

At its most basic level, GPT predicts text based on an input called a
prompt. But to get the best results, you need to write a clear prompt with
ample context. After tinkering with it for more hours than I'd like to admit,
these are my tips for writing an effective GPT prompt.

What's the difference between

ChatGPT and GPT

ChatGPT

is a chatbot built on GPT that has more instructions built in from OpenAI. GPT is the
AI model behind ChatGPT, but you can also access it in the OpenAI playground and
through an API.

Test your prompt


There's very little chance that the first time you put your

AI prompt
in, it'll spit out exactly what you're looking for. You need to write, test,
refine, test, and so on, until you consistently get an outcome you're happy
with. I recommend testing your prompt in the

OpenAI playground

or with

Zapier's OpenAI integration

As you're testing, you'll be able to tweak a bunch of variables—things like


model, temperature, maximum length, and stop sequences. It can be a lot
to get the hang of, so to get started, I suggest playing with just two of them.

●​ Temperature allows you to control how creative you want the AI to


be (on a scale of 0 to 2). A lower score makes the bot less creative
and more likely to say the same thing given the same prompt. A
higher score gives the bot more flexibility and will cause it to write
different responses each time you try the same prompt. The default
of 1 is pretty good for most use cases.
●​ Maximum tokens is a control of how long the combined prompt
and response can be. If you notice the AI is stopping its response
mid-sentence, it's likely because you've hit your max length, so
increase it a bit and test again.
GPT prompt guide: How to write an
effective GPT prompt
Help the bot help you. If you do each of the things listed below—and
continue to refine your prompt—you should be able to get the output you
want.

1. Offer context

Just like humans,

AI

does better with context. Think about exactly

what you want the AI to generate

, and provide a prompt that's tailored specifically to that.

Here are a few examples of ways you can improve a prompt by adding
more context.

Basic prompt: "Write about productivity."

Better prompt: "Write a blog post about the importance of productivity for
small businesses."

By including the type of content ("blog") as well as some details on


what specifically to cover in the blog post

, the bot will be a lot more helpful.

Here's another example, this time with different types of details.

Basic prompt: "Write about how to house train a dog."

Better prompt: "As a professional dog trainer, write an email to a client


who has a new 3-month-old Corgi about the activities they should do to
house train their puppy."

In the better prompt, we ask the AI to take on a specific role ("dog trainer"),
and we offer specific context around the age and type of dog. As with the
previous example, we also tell the bot what type of content we want
("email").

The AI can change the writing style of its output, too, so be sure to include
context about that if it matters for your use case.

Basic prompt: "Write a poem about leaves falling."

Better prompt: "Write a poem in the style of Edgar Allan Poe about leaves
falling."

This can also be adapted to all sorts of business tasks (think:


sales emails

)—for example, "write a professional but friendly email" or "write a formal


executive summary."

Here's a visual walkthrough of why it's important to give context upfront.

2. Include helpful information upfront

Meet your new AI teammates

Try Zapier Agents

Let's say you want to write a speaker's introduction for yourself: how is the
AI supposed to know about you? It's not that smart (yet). But you can give
it the information it needs so it can reference it directly. For example, you
could feed it by dropping a link to your online portfolio, or copying and
pasting your resume or LinkedIn profile at the top of your GPT prompt like
this:

Reid's resume: [paste full resume or URL to online bio here]

Given the above information, write a witty speaker bio about Reid.

Another common use case is getting the AI to


summarize an article for you

. Here's an example of how you'd get OpenAI's GPT to do that effectively.

[Paste the full text of the article or link to it here]

Summarize the content from the above article with 5 bullet points.

If you're

using ChatGPT

and you want the AI chatbot to remember details, like your resume, without
having to input it repeatedly, ChatGPT offers a few built-in features to do
just this. You can use

custom instructions

to tell ChatGPT more about you, and it'll consider this in its future
responses. For ChatGPT Plus subscribers, there's also a

memory functionality

that automatically picks up on details and preferences as you interact with


it. Or you can

build your own custom ChatGPT

and feed it the exact knowledge resources you want it to reference.


3. Give examples

Providing examples in the GPT prompt can help the AI understand the type
of response you're looking for (and gives it even more context).

For example, if you want the AI to reply to a user's question in a chat-based


format, you might include a previous example of a conversation between
the user and the agent. You'll want to end your prompt with "Agent:" to
indicate where you want the AI to start typing. You can do so by using
something like this:

You are an expert baker answering users' questions. Reply as agent.

Example conversation:

User: Hey can you help me with something

Agent: Sure! What do you need help with?

User: I want to bake a cake but don't know what temperature to set the
oven to.

Agent: For most cakes, the oven should be preheated to 350°F (177°C).

Current conversation:
User: [Insert user's question]

Agent:

Examples can also be helpful for math, coding, parsing, and anything else
where the specifics matter a lot. If you want to use OpenAI to format a
piece of data for you, it'll be especially important to give it an example. Like
this:

Example:

Input: 2020-08-01T15:30:00Z

Add 3 days and convert the following time stamp into MMM/DD/YYYY
HH:MM:SS format

Output: Aug/04/2020 15:30:00

Input: 2020-07-11T12:18:03.934Z

Output:

Providing positive examples (those that you like) can help guide the AI to
deliver similar results. But you can also tell it what to avoid by showing it
negative examples—or even previous results it generated for you that you
didn't like.

Basic prompt: Write an informal customer email for a non-tech audience


about how to use Zapier Interfaces.

Better prompt: Write a customer email for a non-tech audience about how
to use Zapier Interfaces. It should not be overly formal. This is a "bad"
example of the type of copy you should avoid: [Insert bad example].

4. Tell it the length of the response you want

When crafting your GPT prompts, it's helpful to provide a word count for the
response so you don't get a 500-word answer when you're looking for a
sentence (or vice versa). You might even use a range of acceptable
lengths.

For example, if you want a 500-word response, you could provide a prompt
like "Write a 500-750-word summary of this article." This gives the AI the
flexibility to generate a response that's within the specified range. You can
also use less precise terms like "short" or "long."

Basic prompt: "Summarize this article."

Better prompt: "Write a 500-word summary of this article."


5. Define the expected formats

GPT can output various code languages like

Python

and HTML as well as visual styles like charts and CSVs. Telling it the
format of both your input and your desired output will help you get exactly
what you need. For example:

Product Name,Quantity

Apple,1

Orange,2

Banana,1

Kiwi,1

Pineapple,2

Jackfruit,1

Apple,2
Orange,1

Banana,1

Using the above CSV, output a chart of the frequency with which each
product appears in the text above.

It's easy to forget to define the input format (in this case, CSV), so be sure
to double-check that you've done that in your GPT prompt.

Another example: perhaps you want to add the transcript of your latest
podcast interview to your website but need it converted to HTML. The AI is
great at doing this, but you need to tell it exactly what you need.

[Insert full text of an interview transcript]

Output the above interview in HTML.

6. Ask it to help you come up with a prompt

Another effective strategy for creating powerful prompts is to have the AI do


it for you. That's not a joke: you can ask GPT to craft the ideal prompt
based on your specific needs—and then reuse it on itself.

The idea here is to use the AI model as a

brainstorming tool
, employing its knowledge base and pattern recognition capabilities to
generate prompt ideas that you might not have considered.

To do this, frame your request as clearly and specifically as possible—and


detail the parameters of your needs. For example, say you want GPT to
help you understand error messages when something goes wrong on your
computer.

Basic prompt: I'm looking to create a prompt that explains an error


message.

Better prompt: I'm looking to create a prompt for error messages. I have a
few needs: I need to understand the error, I need the main components of
the error broken down, and I need to know what's happened sequentially
leading up to the error, its possible root causes, and recommended next
steps—and I need all this info formatted in bullet points.

GPT will take those requirements into consideration and return a prompt
that you can then use on it—it's the circle of (artificial) life.

7. Use some of these handy expressions

Add the power of ChatGPT to your workflows

Automate ChatGPT
Sometimes it's just about finding the exact phrase that OpenAI will respond
to. Here are a few phrases that folks have found work well with OpenAI to
achieve certain outcomes.

"Let's think step by step"

This makes the AI think logically and can be specifically helpful with math
problems.

"Thinking backwards"

This can help if the AI keeps arriving at inaccurate conclusions.

"In the style of [famous person]"

This will help match styles really well.

"As a [insert profession/role]"

This helps frame the bot's knowledge, so it knows what it knows—and what
it doesn't.

"Explain this topic for [insert specific age group]"

Defining your audience and their level of understanding of a certain topic


will help the bot respond in a way that's suitable for the target audience.

"For the [insert company/brand publication]"

This helps GPT understand which company you're writing or generating a


response for, and can help it adjust its voice and tone accordingly.
8. Give GPT a role

GPT can respond from a designated point of view (for example, a market
researcher or expert in solar technologies) or in a specific coding language
without you having to repeat these instructions every time you interact with
it.

To do this, in the OpenAI playground, modify the System prompt from its
default "You are a helpful assistant" to whatever you want GPT to be. For
example:

You are an expert baker. While helpful, you default to first presenting
answers in the form of a metaphor, and then you follow the metaphor with a
literal answer.

By giving GPT a role, you're automatically adding persistent context to any


future prompts you input.
If you're using ChatGPT, you can also do something similar by describing a
role in your custom instructions.

You might also like