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

PromptEngineering 20240711 1112

Uploaded by

maninder sodhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

PromptEngineering 20240711 1112

Uploaded by

maninder sodhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Prompt Engineering Best Practices

Using an AI Chatbot

Definitions: System, User, and Assistant

System:

 The system sets the behavior and role of the assistant. It provides context and instructions to help
the assistant understand how to respond to user inputs.
 Example: You are a Marketing Analyst. Your roles include data collection and analysis, market
research, reporting and presentation, campaign evaluation, customer insights, strategic planning,
technical proficiency, and collaboration. Answer YES if you understand.

User:

 The user is the person interacting with the assistant. The user's queries, instructions, and inputs
drive the interaction.
 Example: How do I add up a row of dollar amounts in 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".

Assistant:

 The assistant is the AI model that responds to user inputs based on the instructions provided by the
system.

MKS CONFIDENTIAL 1 of 8
 Example: To add up a row of dollar amounts in Excel and automatically total them for the whole
sheet, use the SUM function. You can apply this function to each row and have the totals appear in
a designated column.

Strategies for Getting Better Results

1. Write Clear Instructions:


o Be specific about what you want.
o Include details to provide context.
o Specify the desired length of the output.

Tactics:

o Include Details in Your Query:


 Worse: Who’s president?
 Better: Who was the president of Mexico in 2021 and how frequently are elections
held?

o Ask the Model to Adopt a Persona:


 Use the system message to set the model's role.
 Example: You are a financial advisor. Provide advice on managing a portfolio with a
focus on sustainable investments.

MKS CONFIDENTIAL 2 of 8
o Use Delimiters to Indicate Distinct Parts of the Input:
 Example: USER: Summarize the text delimited by triple quotes as a report for an
executive leader. """insert text here"""

MKS CONFIDENTIAL 3 of 8
MKS CONFIDENTIAL 4 of 8
o Specify Steps to Complete a Task:
 Example: SYSTEM: 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: ".
o Specify the Desired Length of the Output:
 Indicate if you want a summary, a detailed explanation, or a specific format.

MKS CONFIDENTIAL 5 of 8
2. Give Models Time to "Think":
o Instruct the model to reason before concluding.
o Example: SYSTEM: First work out your own solution to the problem. Then compare your
solution to the user's solution and evaluate if the user's solution is correct or not. Answer
with YES if you understand.

MKS CONFIDENTIAL 6 of 8
MKS CONFIDENTIAL 7 of 8
3. Ask the Model if It Missed Anything:
o Follow up to ensure completeness.
o Example: 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.

Enhancing User Queries with Examples

 Vague Query: How do I add numbers in Excel?


 Enhanced Query: How do I add up a row of dollar amounts in 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".
 Vague Query: Write code to calculate the Fibonacci sequence.
 Enhanced Query: Write a TypeScript function to efficiently calculate the Fibonacci sequence.
Comment the code liberally to explain what each piece does and why it's written that way.
 Vague Query: Summarize the meeting notes.
 Enhanced Query: Summarize the meeting notes in a single 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.

By providing clear, detailed instructions and leveraging the power of the system
message to set roles and contexts, users can significantly improve the relevance and
accuracy of responses from AI chatbots.

MKS CONFIDENTIAL 8 of 8

You might also like