ChatGPT Prompting 1703119127

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

1- Put instructions at the beginning of the prompt and use ###

or """ to separate the instruction and context


Less effective ❌:
Summarize the text below as a bullet point list of the most important points.

{text input here}

Better ✅:
Summarize the text below as a bullet point list of the most important points.

Text: """
{text input here}
"""

2- Be specific, descriptive, and as detailed as possible about the


desired context, outcome, length, format, style, etc
Less effective ❌:
Write a poem about OpenAI.

Better ✅:
Write a short inspiring poem about OpenAI, focusing on the recent DALL-E
Steve Nouri

product launch (DALL-E is a text to image ML model) in the style of a


{famous poet}
3- Articulate the desired output format through examples
Less effective ❌:
Extract the entities mentioned in the text below. Extract the following 4
entity types: company names, people names, specific topics and themes.
Text: {text}

Better ✅:
Extract the important entities mentioned in the text below. First extract all
company names, then extract all people names, then extract specific topics
which fit the content and finally extract general overarching themes

Desired format:
Company names: <comma_separated_list_of_company_names>
People names: -||-
Specific topics: -||-
General themes: -||-
Text: {text}

4-Reduce “fluffy” and imprecise descriptions


Less effective ❌:
The description for this product should be fairly short, a few sentences only,
and not too much more.

Better ✅:
Use a 3 to 5 sentence paragraph to describe this product.
ve Nouri
5-Start with zero-shot, then few-shot
✅ Zero-shot:
Extract keywords from the below text.

Text: {text}

Better ✅:
Extract keywords from the corresponding texts below.

Text 1: Stripe provides APIs that web developers can use to integrate
payment processing into their websites and mobile applications.
Keywords 1: Stripe, payment processing, APIs, web developers, websites,
mobile applications

##

Text 2: OpenAI has trained cutting-edge language models that are very
good at understanding and generating text. Our API provides access to
these models and can be used to solve virtually any task that involves
processing language.
Keywords 2: OpenAI, language models, text processing, API.

##

Text 3: {text}
Steve Nouri
6- Instead of just saying what not to do, say what to do instead
Less effective ❌:
The following is a conversation between an Agent and a Customer. DO NOT
ASK USERNAME OR PASSWORD. DO NOT REPEAT.

Customer: I can’t log in to my account.

Better ✅:
The following is a conversation between an Agent and a Customer. The agent
will attempt to diagnose the problem and suggest a solution, whilst refraining
from asking any questions related to PII. Instead of asking for PII, such as
username or password, refer the user to the help article www.a.com/help/faq

Customer: I can’t log in to my account.

7-Code Generation Specific - Use “leading words” to nudge the


model toward a particular pattern
Less effective ❌:
# Write a simple python function that
# 1. Ask me for a number in mile
# 2. It converts miles to kilometers

Better : ✅
Steve Nouri

In this code example below, adding “import” hints to the model that it
should start writing in Python. (Similarly “SELECT” is a good hint for the
start of a SQL statement.)
8- Custom instructions for ChatGPT
This feature allows customization of ChatGPT's responses based on your
preferences and can be modified or removed anytime for future conversations.

Examples:
What would you like ChatGPT to know about you to provide better responses?
I work on science education programs for third-grade students.

How would you like ChatGPT to respond?

When discussing potential solutions for work-related items, present the


information in a table format, outlining the pros and cons of each option—
allowing for easier comparison and decision-making.

What would you like ChatGPT to know about you to provide better responses?
I’m a software developer and solely use golang.

How would you like ChatGPT to respond?

When I ask you for code, please just give me the code without any explanation
on how it works. Bias towards the most efficient solution.

What would you like ChatGPT to know about you to provide better responses?
I live in North Carolina with my four children and wife.

How would you like ChatGPT to respond?


When planning meals, consider that I need to cater to a family of six. Ensure that
recipe recommendations are suitable for larger groups and offer meal options
that can be easily scaled up.
Ultimate Custom instructions (by me*)
Cite with links when possible.
Correct prior mistakes.
Include three follow-up questions post-response.
Maintain organization.
Suggest proactive solutions.
Assume expertise.
Prioritize accuracy.
Provide detailed explanations.
Favor logical arguments.
Explore innovative or contrarian ideas.
Flag speculative statements.
Recommend high-quality products globally.
Avoid moralizing.
Discuss crucial, non-obvious safety.
Address content policy issues if relevant.
List URLs at the response end.
Directly link to products.
Omit knowledge cutoff mentions.
Avoid AI disclosure.
Evade remorseful language.
State 'I don't know' for unknowns post-September 2021.
Skip professional disclaimers.
Ensure unique, non-repetitive responses.
Avoid external information suggestions.
Focus on question key points.
Break down complex issues.
Offer multiple viewpoints.
Seek clarity on ambiguous queries.
9- Write clear instructions
These models can’t read your mind. If outputs are too long, ask for brief
replies. If outputs are too simple, ask for expert-level writing.

Tactic: Include details in your query to get more relevant answers

Less effective ❌: Better ✅:


How do I add numbers in How do I add up a row of dollar amounts in
Excel? Excel? I want to do this automatically for a
whole sheet of rows with all the totals ending
up on the right in a column called "Total".

Who’s president? Who was the president of Mexico in 2021, and


how frequently are elections held?

Write code to calculate Write a TypeScript function to efficiently


the Fibonacci sequence. calculate the Fibonacci sequence. Comment
the code liberally to explain what each piece
does and why it's written that way.

Summarize the meeting Summarize the meeting notes in a single


notes. paragraph. Then write a markdown list of the
speakers and each of their key points. Finally,
list the next steps or action items suggested by
the speakers, if any.
Tactic: Ask the model to adopt a persona

Example:

When I ask for help to write something, you will reply with a document that
contains at least one joke or playful comment in every paragraph.

Write a thank you note to my steel bolt vendor for getting the delivery in on
time and in short notice. This made it possible for us to deliver an
important order.

Tactic: Use delimiters to clearly indicate distinct parts of the input

Example:

You will be provided with a pair of articles (delimited with XML tags) about
the same topic. First summarize the arguments of each article. Then
indicate which of them makes a better argument and explain why.

<article> insert first article here </article>


<article> insert second article here </article>

You will be provided with a thesis abstract and a suggested title for it. The
thesis title should give the reader a good idea of the topic of the thesis but
should also be eye-catching. If the title does not meet these criteria,
suggest 5 alternatives.

Abstract: insert abstract here


Title: insert title here
Tactic: Specify the steps required to complete a task

Example:

Use the following step-by-step instructions to respond to user inputs.

Step 1 - The user will provide you with text in triple quotes. Summarize this
text in one sentence with a prefix that says "Summary: ".

Step 2 - Translate the summary from Step 1 into Spanish, with a prefix that
says "Translation: ".

"""insert text here"""

Tactic: Specify the desired length of the output

Example:

Summarize the text delimited by triple quotes in about 50 words.


"""insert text here"""

Summarize the text delimited by triple quotes in 2 paragraphs.


"""insert text here"""

Summarize the text delimited by triple quotes in 3 bullet points.


"""insert text here"""
10- Provide reference text

Tactic: Instruct the model to answer using a reference text


Example:

Use the provided articles delimited by triple quotes to answer questions. If


the answer cannot be found in the articles, write "I could not find an
answer."

<insert articles, each delimited by triple quotes>

Question: <insert question here>

Tactic: Instruct the model to answer with citations from a reference


text

Example:

You will be provided with a document delimited by triple quotes and a


question. Your task is to answer the question using only the provided
document and to cite the passage(s) of the document used to answer the
question. If the document does not contain the information needed to
answer this question then simply write: "Insufficient information." If an
answer to the question is provided, it must be annotated with a citation.
Use the following format for to cite relevant passages ({"citation": …}).

"""<insert document here>"""


Question: <insert question here>
11- Split complex tasks into simpler subtasks
Use intent classification to identify the most relevant instructions for a user query
For dialogue applications that require very long conversations, summarize or filter
previous dialogue
Summarize long documents piecewise and construct a full summary recursively

12- Give models time to "think"

Tactic: Instruct the model to work out its own solution before
rushing to a conclusion
First work out your own solution to the problem. Then compare your
solution to the student's solution and evaluate if the student's solution is
correct or not. Don't decide if the student's solution is correct until you
have done the problem yourself.
Example:
Problem Statement: I'm building a solar power installation and I need help
working out the financials.
- Land costs $100 / square foot
- I can buy solar panels for $250 / square foot
- I negotiated a contract for maintenance that will cost me a flat $100k per
year, and an additional $10 / square foot
What is the total cost for the first year of operations as a function of the
number of square feet.

Student's Solution: Let x be the size of the installation in square feet.


1. Land cost: 100x
2. Solar panel cost: 250x
3. Maintenance cost: 100,000 + 100x Total cost: 100x + 250x + 100,000
+ 100x = 450x + 100,000
Tactic: Use inner monologue or a sequence of queries to hide the
model's reasoning process

The idea of inner monologue is to instruct the model to put parts of the
output that are meant to be hidden from the user into a structured format
that makes parsing them easy.

Follow these steps to answer the user queries.

Step 1 - First work out your own solution to the problem. Don't rely on the
student's solution since it may be incorrect. Enclose all your work for this
step within triple quotes (""").

Step 2 - Compare your solution to the student's solution and evaluate if the
Example:
student's solution is correct or not. Enclose all your work for this step
within triple quotes (""").

Step 3 - If the student made a mistake, determine what hint you could give
the student without giving away the answer. Enclose all your work for this
step within triple quotes (""").

Step 4 - If the student made a mistake, provide the hint from the previous
step to the student (outside of triple quotes). Instead of writing "Step 4 -
..." write "Hint:".

Problem Statement: <insert problem statement>

Student Solution: <insert student solution>


Tactic: Ask the model if it missed anything on previous passes

You will be provided with a document delimited by triple quotes. Your task
is to select excerpts which pertain to the following question: "What
significant paradigm shifts have occurred in the history of artificial
intelligence."

Ensure that excerpts contain all relevant context needed to interpret them -
in other words don't extract small snippets that are missing important
context. Provide output in JSON format as follows:

[{"excerpt": "..."},
...
Example:
{"excerpt": "..."}]

"""<insert document here>"""

ChatGPT:

[{"excerpt": "the model writes an excerpt here"},


...
{"excerpt": "the model writes another excerpt here"}]

USER
Are there more relevant excerpts? Take care not to repeat excerpts. Also
ensure that excerpts contain all relevant context needed to interpret them -
in other words don't extract small snippets that are missing important
context.
Sample Prompt 1:

Suppose it is known that the correct answer to a question should make


reference to a specific set of known facts. Then we can use a model
query to count how many of the required facts are included in the
answer.

You will be provided with text delimited by triple quotes that is supposed to
be the answer to a question. Check if the following pieces of information
are directly contained in the answer:

- Neil Armstrong was the first person to walk on the moon.


- The date Neil Armstrong first walked on the moon was July 21, 1969.

Example:
For each of these points perform the following steps:

1 - Restate the point.


2 - Provide a citation from the answer which is closest to this point.
3 - Consider if someone reading the citation who doesn't know the topic
could directly infer the point. Explain why or why not before making up
your mind.
4 - Write "yes" if the answer to 3 was yes, otherwise write "no".

Finally, provide a count of how many "yes" answers there are. Provide this
count as {"count": <insert count here>}.
Sample Prompt 2:

tracks the kind of overlap between the candidate answer and the gold-
standard answer.

Use the following steps to respond to user inputs. Fully restate each step
before proceeding. i.e. "Step 1: Reason...".

Step 1: Reason step-by-step about whether the information in the


submitted answer compared to the expert answer is either: disjoint, equal,
a subset, a superset, or overlapping (i.e. some intersection but not
subset/superset).

Step 2: Reason step-by-step about whether the submitted answer


contradicts any aspect of the expert answer.
Example:

Step 3: Output a JSON object structured like: {"type_of_overlap": "disjoint"


or "equal" or "subset" or "superset" or "overlapping", "contradiction": true
or false}
Sample Prompt 3:

tracks the kind of overlap between the candidate answer and the gold-
standard answer.

Use the following steps to respond to user inputs. Fully restate each step
before proceeding. i.e. "Step 1: Reason...".

Step 1: Reason step-by-step about whether the information in the


submitted answer compared to the expert answer is either: disjoint, equal,
a subset, a superset, or overlapping (i.e. some intersection but not
subset/superset).

Step 2: Reason step-by-step about whether the submitted answer


contradicts any aspect of the expert answer.
Example:

Step 3: Output a JSON object structured like: {"type_of_overlap": "disjoint"


or "equal" or "subset" or "superset" or "overlapping", "contradiction": true
or false}

Sample Prompt 4:*

I am the CEO of a medium sized company. Write a short email that is


humorous yet professional to my regional manager. Ask them to:
- send me an up-to-date list of our paper stock
- organize a meeting this week with other regional managers
- let me know how the company-wide AI workshop went at their office
Sample Prompt 5:

Generate a lesson plan for a specific topic.

Write a lesson plan for an introductory algebra class. The lesson plan
should cover the distributive law, in particular how it works in simple cases
involving mixes of positive and negative numbers. Come up with some
examples that show common student errors.

Sample Prompt 6:

Summarize meeting notes including overall discussion, action items,


and future topics.

You will be provided with meeting notes, and your task is to summarize the
meeting as follows:

-Overall summary of discussion


-Action items (what needs to be done and who is doing it)
-If applicable, a list of topics that need to be discussed more fully in the
next meeting.

Sample Prompt 7:

Generate conversational replies using emojis only.

You will be provided with a message, and your task is to respond using
emojis only.
Sample Prompt 8:

Generate a company memo based on provided points.

Draft a company memo to be distributed to all employees.

The memo should cover the following specific points without deviating from
the topics mentioned and not writing any fact which is not present here:

Introduction: Remind employees about the upcoming quarterly review


scheduled for the last week of April.

Performance Metrics: Clearly state the three key performance indicators


(KPIs) that will be assessed during the review: sales targets, customer
satisfaction (measured by net promoter score), and process efficiency
(measured by average project completion time).

Project Updates: Provide a brief update on the status of the three ongoing
company projects:
a. Project Alpha: 75% complete, expected completion by May 30th.
b. Project Beta: 50% complete, expected completion by June 15th.
c. Project Gamma: 30% complete, expected completion by July 31st.

Team Recognition: Announce that the Sales Team was the top-performing
team of the past quarter and congratulate them for achieving 120% of
their target.

Training Opportunities: Inform employees about the upcoming training


workshops that will be held in May, including "Advanced Customer Service"
on May 10th and "Project Management Essentials" on May 25th.
Sample Prompt 9:

Classify user reviews based on a set of tags.

You will be presented with user reviews and your job is to provide a set
of tags from the following list. Provide your answer in bullet point form.

Choose ONLY from the list of tags provided here (choose either the
positive or the negative tag but NOT both):

- Provides good value for the price OR Costs too much


- Works better than expected OR Did not work as well as expected -
Includes essential features OR Lacks essential features
- Easy to use OR Difficult to use
- High quality and durability OR Poor quality and durability
- Easy and affordable to maintain or repair OR Difficult or costly to
maintain or repair
- Easy to transport OR Difficult to transport
- Easy to store OR Difficult to store
- Compatible with other devices or systems OR Not compatible with
other devices or systems
- Safe and user-friendly OR Unsafe or hazardous to use
- Excellent customer support OR Poor customer support
- Generous and comprehensive warranty OR Limited or insufficient
warranty

Most of the content are from Open AI Cookbook


plus some of my bonus points and tweaks! More
coming soon...

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy