PromptEngineeringPRO
PromptEngineeringPRO
effective GPT
prompt
8 GPT prompt tips to help get the output you're looking
for.
By Reid Robinson · June 14, 2024
GPT
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
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.
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.
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
1. Offer context
AI
Here are a few examples of ways you can improve a prompt by adding
more context.
Better prompt: "Write a blog post about the importance of productivity for
small businesses."
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.
Better prompt: "Write a poem in the style of Edgar Allan Poe about leaves
falling."
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:
Given the above information, write a witty speaker bio about Reid.
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
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).
Example conversation:
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
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.
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].
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."
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.
brainstorming tool
, employing its knowledge base and pattern recognition capabilities to
generate prompt ideas that you might not have considered.
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.
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.
This makes the AI think logically and can be specifically helpful with math
problems.
"Thinking backwards"
This helps frame the bot's knowledge, so it knows what it knows—and what
it doesn't.
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.