3. Prompt
Engineering
• Prompt engineering is
designing and refining
prompts to effectively
communicate with GenAI
models, improving
quality, relevance, and
accuracy of their
responses.
4. Prompt Engineering
•Prompt Engineering can …
• increase the accuracy and relevance of answers.
• help control the tone, style, and format of
answers.
• enhance the efficiency of answers.
5. Prompt Engineering
•It is important to note that different GenAI
models interpret prompts differently (ChatGPT,
DALL·E, Copilot, etc.), so the most important
thing to do is try out different queries and
different approaches to generating queries,
and see which ones work best.
10. Clarity & Precision
•Using clear and specific language to guide
GenAI responses.
•Let’s say you want an GenAI to generate a
Python function to calculate the factorial of a
number >>>
12. Clarity & Precision
•Good Prompt - Clear & Precise
• Explain the process of photosynthesis
in plants, including the role of
sunlight, chlorophyll, water, and
carbon dioxide.
14. Context & Constraints
•Providing background information or setting
boundaries to get relevant answers.
•Let’s say you want to generate a function to
sort a list of numbers >>>
16. Context & Constraints
•Good Prompt - Provides Context &
Constraints
• Generate a vegetarian pasta recipe that
serves 2 people, can be cooked in under
30 minutes, and does not use any dairy
products. Include a list of ingredients
and step-by-step instructions.
18. Validation & Verification
•Verifying the output of Generative AI (GenAI) is
crucial to ensure accuracy, reliability, and
ethical integrity.
•Here's a structured approach to critically
assess AI-generated content >>>
19. Validation & Verification: Check the
Facts !!!
• Verify Key Information: Scrutinize names, dates,
statistics, and claims by comparing them with credible
sources like academic journals, official reports, or
reputable news outlets.
• Validate Citations: If the GenAI provides references,
ensure they exist and accurately support the content.
GenAI models can sometimes fabricate citations or
misattribute information.
• Use Fact-Checking Tools: Leverage platforms such as
FactCheck.org, Snopes, or Google Fact Check Tools to
confirm the veracity of the information
20. Validation & Verification: Check the
Facts !!!
•Take the CRAAP Test!!!
•Currency
•Relevance
•Authority
•Accuracy
•Purpose
• https://damiantgordon.com/CheckSheets/CHECKSHEET-CRAAP-Test.pdf
23. Repetition & Repetition
•Repetition can help improve prompts —
but it depends on how and why you use it.
•Here’s how repetition can enhance
prompt effectiveness, especially with
GenAI >>>
24. Repetition & Repetition
•Clarifying Intent
•Repeating or rephrasing your request can
reinforce what’s important.
•Example:
•“Give me three bullet points. Just
three clear, short bullet points.”
25. Repetition & Repetition
•Guiding Structure
•GenAI responds well to consistent patterns.
•Example:
•“Write a short story. Make it
short, with a clear beginning,
middle, and end.”
26. Repetition & Repetition
•Stressing Constraints
•Repetition can highlight limits (like tone,
format, or length).
•Example:
•“Use plain language. No jargon.
Really, keep the language plain and
simple.”
27. Repetition & Repetition
•Prompt Tuning
• You can repeat an adjusted version of a prompt
to refine the GenAI's direction.
•First prompt:
• “Summarize this article.”
•Follow-up:
• “Summarize it again, but focus only on
the economic implications.”
31. Iteration & Testing
•Experimenting with different phrasings and
formats to achieve the best output.
•Let’s say we want to generate a function that
checks if a string is a palindrome (reads the
same forward and backward) >>>
34. Iteration & Testing
•Iteration 2 – Adding Constraints
• Summarize the main argument of the
article in 3 bullet points, each no
longer than 20 words.
35. Iteration & Testing
•Iteration 3 – Final Refinement
• Summarize the main argument of the
article in 3 bullet points, each no
longer than 20 words, and avoid
repeating quotes from the text.
36. Iteration & Testing
•Methodology
• Start with a basic prompt and analyze the output.
• Iterate by adding constraints based on
shortcomings.
• Test edge cases to verify correctness.
• Refine until the GenAI’s output meets all
requirements.
38. Role-based Prompts
• Asking the GenAI to act as a specific expert or persona.
• This helps generate more accurate and more context-
aware responses. By assigning a role, you guide the
GenAI's thought process and ensure it presents
responses to the expected expertise level.
• For example, role-based prompt for Business Guru >>>
40. Role-based Prompts
•Role-Based Prompt - More Focused & Useful
• You are a seasoned startup advisor with
15 years of experience in SaaS
businesses. What are the top 5 tips
you'd give a first-time founder
launching a B2B SaaS product?
43. N-Shot Prompting
Prompt Type Explanation
Zero-shot
Prompting (0)
The GenAI is given no examples and must
infer the pattern or solution.
One-shot
Prompting (1)
The GenAI is given one example to learn
from before generating an answer.
Few-shot
Prompting (2-5)
The GenAI is given two to five examples to
learn from before generating an answer.
Multi-shot
Prompting (5+)
The GenAI is given over five examples to
learn from before generating an answer.
44. N-Shot Prompting
•Why is giving examples better?
• More structured & consistent.
• GenAI follows the given style.
• Consistent formatting and readability.
• Encourages GenAI to infer patterns from
examples.
45. N-Shot Prompting
•Zero-shot Prompt - No Examples Given:
•“Write a Python function that converts
Fahrenheit to Celsius.”
One-shot Prompt - One Example Given:
•“Here is a temperature conversion
functions … [SAMPLE CODE] … Now, write
a function to convert Fahrenheit to
Celsius following the same style.”
46. N-Shot Prompting
• Few-shot Prompt – 2 to 5 Examples Given:
• “Here are 2-5 temperature conversion
functions … [SAMPLE CODE] … Now, write a
function to convert Fahrenheit to Celsius
following the same style.”
Multi-shot Prompt – Over 5 Examples Given:
• “Here are over five temperature conversion
functions … [SAMPLE CODE] … Now, write a
function to convert Fahrenheit to Celsius
following the same style.”
47. N-Shot Prompting
• When to use each:
•Zero-shot: Useful for general tasks but may
produce inconsistent results.
•One-shot: Useful for specific task where the
answer needs to closely match the example.
48. N-Shot Prompting
• When to use each:
• Few-shot: Helps guide the GenAI by showing 2-5
examples, improving accuracy and structure. So, use few-
shot prompting when you need consistency, style
matching, or complex logic.
• Multi-shot: Helps guide the GenAI by showing over 5
examples, improving accuracy and structure. So, use
multi-shot prompting when you need a very high level of
consistency, style matching, or complex logic.
49. N-Shot Prompting
• NOTE:
• With Few-Shot and Multi-shot prompting, you
must always be aware of BIAS, there may be
something in the specific examples that the
GenAI might think have to always be contained in
their answers, so review its answers for this.
52. Chain-of-Thought Prompting
•Encouraging step-by-step reasoning for
complex tasks.
•This helps improve accuracy and ensures
logical consistency, especially for
mathematical or algorithmic tasks.
•For example, we have a function that finds the
sum of all even numbers in a list, but it’s giving
incorrect results >>>
54. Chain-of-Thought Prompting
•Chain-of-Thought Prompt
•If there are 3 red balls and 5 blue
balls in a bag, and you take out 2
balls without looking, what is the
probability that both are red?
Please explain your reasoning step
by step.
55. Chain-of-Thought Prompting
•Chain-of-Thought Prompt
• There are a total of 3 red + 5 blue = 8 balls.
• The probability that the first ball drawn is
red is 3/8.
• If the first ball is red, there are now 2 red
and 7 total balls left.
• So the probability that the second ball is red
is 2/7.
• Therefore, the probability that both balls are
red is (3/8) × (2/7) = 6/56 = 3/28.
56. Chain-of-Thought Prompting
•Why better?
• Clear breakdown of the problem before answering it.
• Step-by-step reasoning helps with learning and
debugging.
• Reduces GenAI hallucinations by enforcing structured
logical thinking.
58. Summarization Prompt
• “Summarize the key findings of this research
paper in three bullet points, focusing on
the methodology, results, and conclusions.”
• Why it's good:
• It specifies the desired format (three bullet points).
• It defines the scope (methodology, results, and conclusions).
• It ensures clarity by requesting a summary rather than a full
analysis.
59. Analytical Prompt
• “Compare and contrast the strengths and
weaknesses of supervised and unsupervised
learning, providing examples of real-world
applications for each.”
• Why it's good:
• It requires critical thinking rather than just factual recall.
• It demands structured reasoning (compare and contrast).
• It provides a clear context (supervised vs. unsupervised
learning).
60. Creative Writing Prompt
• “Write a short science fiction story (500
words) set in a world where AI has become
the ruling class. Include a protagonist
who challenges the system.”
• Why it's good:
• It provides a clear theme (AI as rulers).
• It specifies word count (500 words).
• It introduces a conflict (protagonist challenges the system).
61. Code Generation Prompt
• “Write a Python function that takes a list of
numbers and returns the mean, median, and
mode. Ensure the function is efficient and
handles edge cases like empty lists.”
• Why it's good:
• It defines inputs and outputs (list of nums mean, median,
→
mode).
• It includes performance expectations (efficient).
• It asks for error handling (empty lists).
62. Educational Explanation Prompt
• “Explain the concept of entropy in
thermodynamics in simple terms, using an
everyday analogy a 12-year-old can
understand.”
• Why it's good:
• It specifies the complexity level (simple terms).
• It requires an analogy (everyday example).
• It identifies the target audience (12-year-old).
63. Debate and Argumentation Prompt
• “Argue for and against the use of AI in
education. Provide at least two strong
points for each side, then conclude with
your own reasoned opinion.”
• Why it's good:
• It requires balanced reasoning (both sides of the argument).
• It demands specific points (two per side).
• It includes a personal conclusion (opinion).
64. Data Analysis Prompt
• “Given a CSV file containing sales data with
columns for date, product, and revenue, write
a Python script to calculate the total
revenue per product and visualize it using a
bar chart”
• Why it's good:
• It defines the input format (CSV with specific columns).
• It describes expected outputs (total revenue per product).
• It requires a visualization (bar chart).
65. Ethical Discussion Prompt
• “What are the ethical concerns
surrounding deepfake technology? Discuss
both potential harms and possible
benefits, citing real-world examples.”
• Why it's good:
• It prompts critical thinking (ethical concerns).
• It requires both pros and cons (harms + benefits).
• It encourages real-world applications (examples).
66. Roleplaying/Simulation Prompt
• “Imagine you are a data scientist presenting
findings to a non-technical executive team.
Explain the key insights from your predictive
model in a way that emphasizes business
impact.”
• Why it's good:
• It provides a clear role (data scientist).
• It sets a target audience (non-technical executives).
• It emphasizes practical application (business impact).
67. Multimodal Prompt
• “Describe what a violin sounds like using
only visual and tactile metaphors.”
• Why it's good:
• It forces creative thinking (visual and tactile metaphors).
• It removes direct sensory descriptions, making it more
challenging.
• It encourages unique, engaging responses.