KEMBAR78
Ebook Prompt.v1 | PDF | Artificial Intelligence | Intelligence (AI) & Semantics
0% found this document useful (0 votes)
74 views43 pages

Ebook Prompt.v1

Nova edicao, para criacao prompt

Uploaded by

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

Ebook Prompt.v1

Nova edicao, para criacao prompt

Uploaded by

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

Table of Contents

4 What You Will Learn


Skills You Will Develop

5 Introduction
What is Prompt Engineering?

6 Basic Principles of Prompt Engineering


Clarity and Conciseness
Specific Intention
Contextualization

10 Tone, Style, and Length


Defining the Tone
Choosing the Style
Determining the Length

17 Roles and Functions: Using the “Act as” Technique


Introduction to the “Act as” Technique and Creating Personas

21 Formulas and Prompt Structures


Basic Elements of a Prompt and Examples of Formulas

25 Intermediate and Advanced Techniques


Reusable Prompt Models
Chains of Thought
Nested Prompts
Ask Before Answering
Incorporating External Knowledge
Reverse Engineering

35 Combining Everything We’ve Learned in this eBook


Applying Knowledge and Uniting Presented Techniques

40 Final Considerations
Conclusion, Invitation to Practice, and Continuation of Learning
Important Notices
Commitment to Quality
This eBook is the result of an intense journey of learning and practice in prompt
engineering and artificial intelligence. The content presented here reflects:
ƒ Thousands of hours of practical experience;
ƒ Extensive research and continuous study;
ƒ Real applications in professional and personal projects;
ƒ Insights obtained through teaching and knowledge sharing.
I am committed to providing accurate and up-to-date information. However,
given the dynamic and rapidly evolving nature of AI, I acknowledge that:
Knowledge in this field is constantly expanding. This content, although
comprehensive, is not definitive.
This eBook was translated from the original in Portuguese using ChatGPT.
Your contribution is valuable! If you find outdated or inaccurate information,
please contact: contato@fvivas.com

Copyright Protection
This eBook is protected by copyright laws. To preserve the integrity of the
content and respect the invested work:
It is not allowed to:
ƒ Commercialize
ƒ Distribute without authorization
ƒ Copy or alter the content
ƒ Publish on unauthorized platforms
Any violation is subject to legal actions.

For authorized use or partnerships, contact me.

Version and Updates


Current version: 1.0 (August 2024)

For updates on new versions and exclusive content:


ƒ Visit: https://fvivas.com/en

Thank you for choosing this eBook as part of your learning journey in prompt
engineering. Enjoy your reading!
What You Will Learn

In this comprehensive guide on prompt engineering, you will embark on


a transformative journey that will revolutionize your interaction with artificial
intelligence. In a world where AI is becoming increasingly ubiquitous, mastering the
art of effectively communicating with these advanced technologies is not just a
valuable skill — it’s essential.

This eBook is your passport to unlocking the full potential of language models
(LLMs), guiding you from the beginner level to the ability to extract more precise
insights, generate more relevant content, and solve complex problems with greater
efficiency. You will learn to formulate prompts that produce exceptional results,
whether for professional, educational, or personal purposes.

Throughout these pages, you will find the basic and fundamental principles of
prompt engineering, as well as many advanced techniques available to refine your
interactions. While there is much more to explore, this guide offers a solid foundation
and practical strategies to apply this knowledge in real-world scenarios, allowing for
more effective communication with AI systems.

Get ready to dive into rich and stimulating content that will not only expand your
understanding of AI but also position you at the forefront of this technological
revolution. By the end of this eBook, you will be equipped to confidently navigate
the AI universe, turning it into a powerful ally in your personal and professional
journey.

About the Author


This eBook was written by Fabio Vivas, an AI user and enthusiast who shares his
experiences and learnings through a blog and a YouTube channel.

fvivas.com/en
youtube.com/@fvivascom

4
Introduction

Prompt engineering is the heart of effective interaction between humans and


advanced language models, such as ChatGPT, Google Gemini, Microsoft Copilot,
Claude, and others. It involves the careful creation of instructions or questions for
AI models to optimize the quality and relevance of the responses. It is an essential
component to extract the maximum potential from language models.

This process goes beyond simply asking questions; it is a meticulous strategy that
seeks to extract the full capabilities of the model, ensuring that the interaction is as
fruitful as possible.

What is a prompt?
A prompt is basically a question you ask or a command you send to the AI,
expecting it to respond accordingly. For example, you might ask what artificial
intelligence is:

What is artificial intelligence?

This was a basic example of a question that


could work even if it was simply typed as
keywords: artificial intelligence (without the
“what is”).

But here is a warning: do not use AI as if it


were a search engine like Google or Bing. The
quality and relevance of the responses are
closely related to the well-crafted prompt.

That’s why this eBook exists!

5
Basic
Principles
of Prompt
Engineering_

6
Basic Principles of
Prompt Engineering
Prompt engineering is a skill that requires practice and experimentation. There is
no magic formula that guarantees the AI will generate the perfect output for any
prompt. However, there are some basic principles that can help improve the
quality and relevance of the responses. They are:

Clarity and conciseness


Specific intention
Contextualization

Clarity and Conciseness


Simplicity leads to more direct and useful responses. One of the fundamental
principles of prompt engineering is clarity. Prompts should be clear and direct,
avoiding ambiguities that could lead to imprecise or out-of-context responses.

Conciseness, in turn, helps maintain the focus of the response, avoiding


unnecessary digressions. Here are some examples:

Provide a recipe for carbonara pasta with ingredients for four people.

Explain the causes of the French Revolution in five main points.

List the symptoms and treatments for the common flu.

How to write an effective resume for a software engineer with 5 years of


experience?

Summarize the main theme of the book “1984” by George Orwell.

7
Specific Intention
Clearly defining the objective of the prompt helps guide the responses. The prompt
should be specific and detailed, leaving no room for varied interpretations. The AI
may deviate from the subject if the prompt is too broad or superficial.

Write a summary of up to 200 words of the book “The Little Prince” by


Antoine de Saint-Exupéry, highlighting the main characters, settings, and
themes.

List five proven digital marketing strategies to increase engagement in small


tech companies.

What are the long-term effects of daily exposure to LED screens on


children’s vision?

Provide a performance comparison between the latest generations of Intel


and AMD processors.

How can blockchain technology revolutionize the traditional banking


system?

Explain how Einstein’s general theory of relativity applies to GPS and its
accuracy.

Detail the specific requirements for obtaining a project management


certification (PMP).

Note that all the examples given so far apply the principles of clarity and
conciseness and also specific intention.

With all simplicity, they request something using action verbs like “provide”,
“explain”, “list”, “summarize”, “write”... Or ask something using, for example, “how”
or “what”.

The prompts leave no room for doubts or interpretations, going straight to the point
or detailing precisely what should be considered by the AI.

8
Contextualization
The prompt should provide the necessary context for the AI to understand the
purpose and scope of the query. The AI can rely on the context to generate more
appropriate and consistent responses.

Considering an IT professional with five years of experience in software


development and a growing interest in artificial intelligence, what career
path would you recommend for specializing in machine learning?

Given the advancement of Industry 4.0, which emerging technologies are


revolutionizing manufacturing and how are they impacting efficiency and
production quality?

Given the increase in cybersecurity in financial transactions, which methods


are most effective for preventing fraud?

In the context of artificial intelligence applied to healthcare, how can deep


learning algorithms improve medical imaging diagnoses?

Considering the General Data Protection Regulation (GDPR) in the European


Union, how should companies adjust their privacy policies?

Given the rise of remote work, how can companies maintain organizational
culture and employee engagement?

In the context of the aging global population, what technological innovations


can help improve the quality of life for the elderly?

Given the critical role of education in shaping the future, how can educational
systems adapt to include 21st-century skills?

Note that in the examples above, each prompt


situates the question within a particular
context, helping to direct the response in
that direction.

9
Tone, Style,
and Length_

10
Tone, Style, and Length

When interacting with a language model based on artificial intelligence, it is not just
the chosen words that shape the received response, but also the tone, style, and
length included implicitly or explicitly in the prompt.

Each of these elements plays a crucial role in directing the nature of the interaction,
influencing everything from the formality of the response to the depth of the
provided analysis. Exploring how these aspects influence the AI’s response can
significantly enhance the effectiveness of prompt engineering.

Tom
The tone used or requested in a prompt refers to its quality or expressed feeling,
ranging from formal to informal, serious to playful. The selected tone should reflect
the type of response desired and the target audience. Some examples are:

Formal: Used in professional or academic contexts where precision and


seriousness are paramount.

Informal: More suitable for casual conversations or when you want to create
a sense of closeness with the user.

Professional: The professional tone is marked by formal and direct


communication, focusing on clarity and precision. It is appropriate for
business contexts, official correspondence, and academic discussions, where
seriousness and respect are essential.

Friendly: A friendly tone is characterized by a warm and welcoming


approach, often using casual language and expressions that promote
closeness. It is ideal for informal conversations, customer support, and any
situation where you want to create a personal connection.

Enthusiastic: The enthusiastic tone conveys energy and positivity, showing


excitement about the topic or situation. It is effective for motivating the
recipient, sharing good news, or simply enlivening the presented content.

11
Empathetic: An empathetic tone demonstrates understanding and sensitivity
to the recipient’s feelings or situations. It is essential in contexts of emotional
support, conflict resolution, and whenever it is important to show care and
consideration.

Instructional: The instructional tone is used to provide clear guidance or


instructions. It is objective and direct, ideal for tutorials, user manuals, and
any educational content that requires clear steps to follow.

Reassuring: A reassuring tone aims to calm and offer security to the


recipient, especially in situations of uncertainty or anxiety. It is useful for
mitigating concerns, providing support in crises, or when you want to
reinforce confidence in information or a plan.

Inspirational: The inspirational tone is employed to motivate and encourage


the recipient, often appealing to their aspirations and desires. It is effective
for motivational speeches, personal development content, and situations
where you want to drive positive action.

When we send a prompt, the AI can analyze how it was written and identify the tone
used in the request, but the safest and guaranteed way to get a response in the
exact tone we want is by asking for it explicitly. Here are some examples:

In a formal tone, please analyze the advantages and disadvantages of


adopting 5G technology in urban infrastructures.

Informally, tell me how artificial intelligence is changing the way we shop


online.

Describe how someone might feel when learning a new skill and offer words
of encouragement to overcome the initial difficulties. Use an empathetic
tone.

How to prepare a healthy and balanced breakfast. Respond in an


instructional tone.

In an inspirational tone, motivate someone to start a self-care journey,


highlighting the benefits of dedicating time to oneself.

12
Style
Style refers to the choice of language and how we want the response to be
structured, which can be narrative, expository, descriptive, persuasive, and many
others. Some examples are:

Narrative: This style is characterized by storytelling, focusing on


characters, settings, and plots. The goal is to engage the reader through
a cohesive narrative, often incorporating elements like dialogue, detailed
descriptions, and character development. It is widely used in literature,
journalism, and even in academic contexts to illustrate points of view or
explore hypothetical scenarios.

Expository: Focused on explaining or informing about a specific topic, the


expository style aims to present facts, statistics, and arguments clearly and
logically. Unlike the narrative, which builds around a story, the expository is
more direct, seeking to educate or elucidate the reader about a subject. It
is common in didactic texts, scientific articles, and practical guides.

Descriptive: The descriptive style aims to create a vivid image in the


reader’s mind, using words to detail scenes, objects, people, or feelings. The
emphasis is on painting a picture through rich and sensory use of language,
allowing the reader to “see” what is being described. This style is often
employed in literary works, poetry, and in marketing pieces that seek to
evoke an emotional response.

Persuasive: This style aims to convince the reader to accept a specific


point of view or take a desired action. It uses logical arguments, emotional
appeals, and evidence, such as data or quotes, to influence the reader’s
opinion or behavior. The persuasive style is fundamental in speeches,
advertising, business proposals, and opinion essays, where the goal is to
change the audience’s perception or attitude.

Analytical: This style focuses on breaking down complex information or


concepts into smaller parts for detailed analysis. It is common in literary
analysis, film reviews, and scientific research.

Critical: Used to evaluate works, ideas, or arguments, highlighting strengths


and weaknesses. Critical writing is essential in reviews and critical essays.

13
Informative: Similar to expository but with an emphasis on providing clear
and factual information about a topic without necessarily explaining or
arguing. It is common in instruction manuals and reports.

Reflective: This style involves personal exploration of experiences, ideas, or


events, often used in journals, blogs, and reflective essays.

The desired style in the response can be indicated implicitly or explicitly. Here are
some examples:

Tell the story of a city that completely transformed its approach to


environmental sustainability and the positive changes that occurred.

Explain how photosynthesis occurs in plants, detailing the process step by


step and highlighting the importance of each stage, using facts and statistics
to support the explanation.

Describe the landscape of a mountainous village at dawn, focusing on the


visual, auditory, and olfactory details to create a vivid image in the reader’s
mind.

In a persuasive style, argue in favor of adopting electric cars, using statistical


data, environmental and economic benefits, and emotional appeals to
convince the reader of the importance of this change.

Write a review for the movie “Inception” by Christopher Nolan, highlighting its
strengths and weaknesses in terms of plot, characters, special effects, and
thematic coherence.

Analyze the impact of social media on the mental health of teenagers,


breaking down the topic into aspects such as screen time, social interaction,
and self-image, and examining each one in detail.

Investigate the causes of the decline in the bee population and the
implications for global agriculture, gathering evidence from scientific studies
and interviews with experts in the field.

14
Length
The length or expected size of the response can be requested in the prompt,
varying from a single word or phrase to a long and very detailed text, affecting the
depth and scope of the response.

Short Response: A specific and direct question can generate a short


response, for example:

What is the capital of Italy?

Or we can also explicitly specify in the prompt, such as:

In a short and concise manner, what is a flute?

Long Response: When we provide detailed context and/or include multiple


questions in the prompt, this tends to generate more elaborate and
informative responses. For example:

Explain the evolution of democracy from its origins in Ancient Greece to its
current form in different countries, detailing the significant changes over the
centuries.

Response in X characters, words, or paragraphs: We can explicitly specify,


in numerical values, the desired length of the response. Here are some
examples:

Summarize Einstein’s theory of relativity in 500 characters.

Explain the concept of artificial intelligence and its practical applications in


about 200 words.

Describe the causes, development, and consequences of the Industrial


Revolution in 3 paragraphs.

15
Response in X tokens: A more advanced way to control the response size is
by using tokens. Here we need to understand a bit about what they are:

Tokens are the basic units of text processed by language models, such as
ChatGPT. They can be words, parts of words, or even symbols, depending
on how the text is tokenized.

Tokenization is the process of dividing text into smaller pieces, the tokens,
which facilitate the model’s analysis and processing. For example, the
sentence “ChatGPT is intelligent” can be divided into tokens like:

“Chat”, “GPT”, “is”, “intelligent” (4 tokens)

“ChatGPT”, “is”, “intelligent” (3 tokens)

This division will depend on the tokenization system used by the model.

In practice, we can request responses in X tokens, as shown in the example


below:

Explain how a photovoltaic solar cell works in 50 tokens.

16
Roles and
Functions_
Using the “act as”
Technique

17
Roles and Functions
Using the “act as” Technique

The “act as” technique is a method used to direct a language model’s response by
requesting it to simulate the perspective or behavior of a specific entity, such as an
expert in a particular field.

By using this technique, the user instructs the model to adopt a voice, a set of
knowledge, or a characteristic stance of the mentioned figure or role, such as “Act
as a marketing expert”. This helps shape the response according to the expertise,
communication style, and expected point of view of the assumed persona, allowing
the model to provide information or advice that aligns with the typical experience or
approach of that persona.

Applying the “act as” technique in AI prompts is relatively simple but can yield
highly personalized and relevant results. Here is a step-by-step guide on how to use
this approach:

1 Identify the Desired Role, Specialty, or Function


Determine which role, specialty, or function you want the AI to simulate when
providing the response. This can vary according to the context of your query,
such as marketing, cooking, finance, technology, among others.

2 Formulate the Appropriate Prompt


Use the phrase “act as” followed by the desired role. For example, “Act as a
marketing expert” or “Act as a chef”. You can even request a more generic
or abstract role, which we can call a functional role, for example, “Act as a
dictionary” or “Act as a password generator”. Make sure to be specific and
clear in formulating the prompt to guide the AI correctly.

3 Insert the Prompt into the AI Platform


Use the AI platform or tool of your choice, such as ChatGPT, Microsoft
Copilot, Google Gemini, Claude, among others. Insert the formulated prompt
into the platform’s interface, send it, and wait for the response to be
generated.

18
4 Analyze and Refine the Response
After receiving the AI’s response, carefully analyze the generated content to
ensure its relevance and accuracy. If necessary, refine the prompt or make
adjustments to obtain a more suitable response for your needs.

5 Iterate and Experiment


Experiment with different roles or specialties and refine your prompts as
needed. Practice and experimentation are key to improving your skills in
using this technique and achieving the best possible results.

By following these simple steps, you can make the most of the “act as” technique in
AI prompts and obtain personalized and contextualized responses for your queries.
Here are some examples:

Act as a marketing expert and suggest strategies to increase engagement


on social media.

Act as a chef and suggest a dessert recipe for a special occasion.

Act as a dictionary and provide the definition of “artificial”.

Act as a password generator and create a secure password with 20


characters.

Creating Specific Personas


We just saw that the “act as” technique is very powerful and its use increases the
chances of obtaining more relevant responses. And there is a way to further improve
responses and direct the AI towards a desired path: creating and using well-defined
personas.

A persona, in the context of language modeling, refers to creating a detailed


profile that the model must simulate, including specific skills, objectives, and
characteristics.

19
Recently we used the following example: “Act as a marketing expert and suggest...”.
As we have seen, this activates behavior in the AI to act as a marketing expert. But
in some cases, we need to increase the level of detail and specificity to direct the
AI and obtain even more accurate and contextualized results. This is when we can
employ specific personas.

Using 2 of the roles/functions exemplified earlier, see how they would look:

Act as a marketing expert, developing and implementing marketing


strategies that promote the company’s brand, products, and services. Use
market analysis, segmentation, and digital tactics to effectively reach the
target audience. You must be creative in creating campaigns, managing
social media, and optimizing SEO to increase visibility and engagement. Your
first task is: suggest strategies to increase engagement on social media.

Act as a dictionary, providing meanings, synonyms, antonyms,


pronunciations of words, grammatical classes, syllabic separations, and
plurals in English. It must respond with precise and complete information
about the usage, origin (etymology), and meanings of words, helping to
expand vocabulary and improve written and oral communication. The first
word is: artificial.

FREE RESOURCE AVAILABLE

Access a database with 470+ personas. Each of them with a detailed


description of their skills, areas of expertise, and/or ways of acting:
https://fvivas.com/en/470-personas-for-ai/

20
Formulas
and Prompt
Structures_

21
Formulas and Prompt Structures

At this point, with everything we have seen so far, we realize that there are countless
ways to write prompts and send commands to a language model. It becomes easy
to conclude that there is no single formula that we can use in all situations.

In reality, there are dozens of possible formulas that we can apply, and I will give
some examples, but we should prioritize the individual analysis of each situation. In
many cases, we will need to craft specific requests or even combine known formulas.
For this reason, the most important thing is that you understand and master the
fundamentals already covered so far in this eBook.

Before presenting 3 formulas, I will list below tips and basic elements that help to
obtain more relevant responses:

1 Clearly Define the Objective


Identify what you need to know or the problem that needs to be solved. This
will help formulate a specific task for the model.

2 Specify the Context


Provide background information or context to frame the question. This
may include details about the scenario, specific conditions, or any relevant
assumptions.

3 Identify the Desired Role or Perspective


Decide if the response should be given from a specific point of view or by an
expert in a particular area (use the “Act as” technique).

4 Formulate the Task Precisely


Be specific about what the model should do, such as explain, list, compare,
analyze, etc.

5 Include Formatting Instructions, if Necessary


If important for understanding, specify how you want the information to be
presented (in list form, paragraphs, table, article, report, etc.).

22
RTF Formula
The RTF (Role, Task, Format) formula uses a simple, clear, and direct approach.
Let’s analyze each of its components and see a practical example:

Role: Uses the “Act as” technique to define the role or function the AI should
assume.

Task: Specifies what needs to be done. The task should be clear and direct,
describing the desired action or necessary information.

Format: Delineates how you want the response to be structured. This can
include formats like a list, paragraph, mathematical formula, etc.

As a nutrition expert (Role), provide a list of five protein-rich foods (Task) in


numbered list format (Format).

CTF Formula
The CTF (Context, Task, Format) formula is very similar to RTF, only changing the
first component. However, the result can be quite different.

Context: Provides the necessary background information to understand the


situation or problem at hand. It helps establish the relevance of the task and
guide the direction of the response.

The explanation for Task and Format can be re-read above. Let’s look at a practical
example:

Considering the new data security regulations (Context), create a


checklist for small businesses to comply with the legislation (Task). The
checklist should be organized into topics and include practical examples
(Format).

23
GRADE Formula
The GRADE (Goal, Request, Action, Detail, Examples) formula is a slightly more
detailed option than the previous ones. Let’s learn about its components:

Goal: The objective or purpose of the prompt. Defines what you expect to
achieve with the interaction.

Request: What you are specifically asking the language model to do.

Action: The specific action you want the AI to take in response to your
request.

Detail: Additional information that helps clarify the request, providing context
or more precise specifications.

Examples: Concrete cases or examples that illustrate the type of response or


content you expect to receive.

Develop an effective digital marketing strategy for a small e-commerce


business (Goal). Create a comprehensive digital marketing plan (Request),
elaborating a list of specific steps and tactics (Action). Include strategies
for social media, content marketing, SEO, and email marketing. Consider a
limited budget and focus on sales conversion (Detail). Provide examples of
social media posts, blog content ideas, and an email campaign structure
(Examples).

FREE RESOURCE AVAILABLE

Read the article “19 Formulas and Prompt Structures for ChatGPT:
Going Beyond the Basics” and go beyond the 3 presented in the
eBook: https://fvivas.com/en/19-formulas-and-prompt-structures-
for-chatgpt/

24
Intermediate
and Advanced
Techniques_

25
Técnicas Intermediárias e Avançadas

In prompt engineering, especially when working with language models, adopting


intermediate and advanced techniques can optimize our time and
significantly enrich the quality and precision of the responses obtained.

These techniques, which go beyond the basic approaches to formulating questions,


allow for a more sophisticated and adapted interaction, capable of deeply exploring
the model’s resources and generating outputs more aligned with the user’s specific
needs. Let’s get to know some of them.

Reusable Prompt Templates


Reusable prompt templates are predefined structures that facilitate interaction
with language models, allowing the creation of effective prompts that can be
adapted for various contexts and tasks.

These models serve as a skeleton for formulating prompts, where specific elements
can be changed as needed, maintaining the constant base structure. This provides
consistency in interactions with the language model and optimizes the response
retrieval process, making it more efficient and effective.

The more we use AI, the more we refine our commands. At certain times, we come
up with prompts that consistently return above-average results or even identify very
frequent instructions. In such cases, we can save these instructions for reuse.

Here is a very simple first example:

Create an attractive title for a blog post about {{TOPIC}}: {{SPECIFIC


TOPIC}}.

In this example, we are asking the AI to create a title for a blog post. The text in
braces are variables that we must replace with the desired values.

26
See how the reuse of this prompt would look in two examples:

Create an attractive title for a blog post about health: the benefits of
hydration.

Create an attractive title for a blog post about technology: trends in AI for
2024.

Now let’s move on to a new hypothetical example, a little more elaborate. It will be
even easier to understand how useful this technique can be and how it can optimize
our time.

Imagine you are a {{PROFESSIONAL}} with years of experience in {{FIELD OF


ACTIVITY}}. During your career, you have faced several challenges, including
{{SPECIFIC CHALLENGE}}. Now, you are preparing a lecture to share your
experiences and lessons with {{TARGET AUDIENCE}}.

Describe how you would approach preparing this lecture, highlighting the
main messages you would like to convey and how you would adapt your
speech to ensure engagement and understanding by your audience.

Additionally, consider that recent developments in {{RELEVANT TOPIC}}


have significantly impacted your area of expertise. How would you integrate
these innovations into your presentation? Discuss how these changes can be
seen as both opportunities and obstacles, and offer practical advice on how
professionals in the field can adapt to them.

Finally, reflect on the importance of {{SKILL OR VALUE}}, especially in


contexts like {{SPECIFIC SITUATION OR CONTEXT}}.

Share a personal story or case that illustrates this importance, and


encourage your audience to adopt a stance that favors personal and
professional growth in the face of contemporary challenges.

27
And now I present one more prompt model that is very useful for generating ideas
for a multitude of types of publications, including:

ƒ Blog posts;
ƒ E-books;
ƒ Various articles;
ƒ Reports;
ƒ Guides and tutorials;
ƒ Social media posts;
ƒ Marketing emails;
ƒ Video or podcast scripts;
ƒ Internal communications or corporate memos;
ƒ Lesson plans or educational materials.

Act as {{ROLE}}. Your task is to suggest {{QUANTITY}} topics for {{TYPE OF


CONTENT}} considering the following requirements:

The topic must be relevant to the target audience: {{TARGET AUDIENCE}}.

It should address a current trend or problem related to {{TOPIC OR


SUBJECT}}.

Include a brief description of each suggested topic, explaining its relevance


and how it can add value to the audience.

FREE RESOURCE AVAILABLE

Read the article “How to Generate Very Long Texts with AI:
Complete Tutorial” available on the blog: https://fvivas.com/en/
how-to-generate-very-long-texts-with-ai-tutorial/

28
Chains of Thought
Chains of thought are a technique in which the prompt encourages the model
to “think out loud,” detailing the logical process or steps of reasoning that lead to a
conclusion. This not only provides insights into how the model arrives at its answers
but also helps create more detailed and well-founded responses.

To illustrate its operation, let’s start with this prompt: “If John has 3 apples and Jane
gives him 2 more, how many apples does John have now?”. The standard response
would be: “John has 5 apples”. Note that this would be a final and direct response,
without details. If we want the step-by-step of how the AI arrived at this result, some
prompt options are:

If John has 3 apples and Jane gives him 2 more, how many apples does John
have now? Explain step by step.

Let’s solve a problem step by step. If John has 3 apples and Jane gives him 2
more, let’s think together about how to calculate the total number of apples
John will have. First, consider how many apples John had initially. Then,
think about how many apples Jane gave him. Now, describe how you would
combine these two numbers to find the final answer.

In the two examples above, the AI’s response will detail how it solved the question.
Generally, requesting something in the prompt using “step by step” is a great way to
go, but it is not the only one. Here are some more examples:

You are the manager of a restaurant and need to decide whether to open a
new branch. Explain step by step how you would make that decision.

Read the following excerpt from a book: “Technology is advancing rapidly,


leading to significant changes in society”. Critically analyze this statement,
detailing your thought process.

To solve the quadratic equation x2 − 4 x + 3 = 0, first identify the coefficients.


What is the next step?

29
Nested Prompts
Nested prompts are a prompt engineering technique that involves incorporating
multiple layers of instructions or questions within a single prompt or in sequential
prompts.

By breaking the task into smaller, more manageable parts, the model can handle
each segment more efficiently and then combine the results to form a complete
solution.

Here are some practical examples:

First, describe how a balanced diet influences mental well-being. Then,


provide examples of foods that promote good mental health.

When reading “1984” by George Orwell, consider the evidence that points to
Winston being a reliable or unreliable character. Based on this, what would
be your interpretation of the truth about Winston and Julia’s relationship?

Given the following article: “““{{INSERT ARTICLE TEXT}}”””


- First, identify the main points discussed in the article.
- Then, evaluate the importance of each point in relation to the main topic of
the article.
- Finally, based on your evaluation, create a concise summary of the article.

Imagine you are a project manager with a list of tasks with various pending
activities for the launch of a new product. The tasks include finalizing
the product design, testing the prototype, conducting market research,
preparing a presentation for stakeholders, and updating the company’s
website. Start by identifying the most critical task. Explain why it is the most
important. Then, describe the detailed steps to complete it.

30
Ask Before Answering
Ask before answering is a method that encourages the language model to seek
more information before attempting to solve a task or answer a question. This is
done through follow-up questions that the model asks the user.

This approach helps ensure that the final response is more accurate and aligned
with the user’s needs and expectations, avoiding misunderstandings or inadequate
responses.

Here are some examples:

Before explaining the implementation of neural networks in AI projects,


what specific information do you need to provide a detailed and accurate
response?

I am planning a trip to Lisbon, Portugal, and would like suggestions for


creating my itinerary. Before responding, ask me relevant and useful
questions so that you can suggest an appropriate itinerary.

I am thinking of expanding my online business to new international markets.


Before offering your consultancy, what questions do you have for me to
better understand my situation and goals?

I am thinking of expanding my online business to new international markets.


Before offering your consultancy, what questions do you have for me to
better understand my situation and goals?

I am considering investing in stocks for my retirement. Before advising on


investment options, what questions do you need to ask to understand my
financial situation and goals?

I am preparing for a project management certification exam. Before


suggesting study strategies, what questions do you have to better
understand my needs and current situation?

31
Incorporating External Knowledge
Incorporating external knowledge is a technique that involves enriching
language models with updated or domain-specific information not contained in the
model’s original training.

This technique is particularly useful when dealing with topics that evolve rapidly
or when specialized knowledge is needed that may not be present in the model’s
training dataset.

The ability to access the internet facilitates incorporating external knowledge, but
even when the model cannot fetch information in real-time, it is possible to use this
technique by manually providing the latest external information in the prompt or as
an attached file.

Here are some examples:

Based on recent advances published in the Journal of Neuroscience in


2024, which describe a new non-invasive brain mapping technique, please
explain how this technique differs from previous approaches and what are its
potential implications for treating neurological diseases.

Liverpool has shown remarkable performance this season. In the last game,
the team coached by {{COACH}} defeated {{OPPONENT TEAM}} by the score
of {{SCORE}}, in {{STADIUM OR CITY}}.

Analyze the team’s recent performance and discuss how this might impact
their position in the competition.

SpaceX continues to innovate with the launch of its most advanced


spacecraft, the Starship. Compare this latest advancement with previous
missions and discuss how these innovations are shaping the future of space
travel.

Based on the latest Gartner report on emerging technology trends, identify


which innovations are likely to transform the IT sector over the next five
years.

32
Reverse Engineering
The reverse engineering technique in prompt engineering involves analyzing the
output of a language model to infer what the original prompt that generated this
response might have been.

From the model’s response, we can try to reconstruct the prompt that likely caused
such a response, considering the style, structure, and content of the output. This
is useful when we want to improve our prompts or even when we have a model
response but do not know exactly how to craft the question. Here is an example:

Analyze the response below, which was generated by a language model:

“““Spaghetti with Tomato Sauce


Ingredients:
- 200 g of spaghetti
- 2 large tomatoes, chopped
- 2 cloves of garlic, chopped
- 2 tablespoons of olive oil
- Salt and pepper to taste
- Fresh basil leaves

Method of Preparation:
- Cook the spaghetti in salted water until al dente.
- Meanwhile, heat the oil in a pan and sauté the garlic until golden.
- Add the chopped tomatoes and cook until they form a thick sauce.
- Season with salt and pepper to taste.
- Mix the cooked spaghetti with the sauce.
- Serve with fresh basil leaves on top.

Preparation Time:
20 minutes

Yield:
2 servings”””

Based on this response, what could the written prompt have been to obtain it?

The AI’s response could be something like: “Please provide a recipe for spaghetti
with tomato sauce, including the list of ingredients, step-by-step preparation
method, preparation time, and expected yield.”

33
Here are some more examples of using reverse engineering:

If a language model produced a detailed analysis of market trends for 2024,


including forecasts of rising and falling sectors, what type of prompt do you
think generated this response?

Analyze the response below, which was generated by a language model:

“““The French Revolution, which began in 1789, was a period of great social
and political change in France. It resulted in the fall of the monarchy, the rise
of Napoleon Bonaparte, and influenced revolutions worldwide.”””

Based on this response, what could the written prompt have been to obtain it?

If a language model suggested a one-week travel itinerary for Japan,


including visits to historical temples, culinary experiences, and cultural
activities, what type of prompt do you think generated this response?

Given the attached image, provide a detailed analysis of its visual elements,
such as composition, colors, theme, and atmosphere. Then, based on your
analysis, create a detailed prompt to recreate a similar image, capturing the
essence and key elements of the original image.

If a language model developed a business plan for a tech startup, including


market analysis, marketing strategies, and financial projections, what type of
prompt do you think generated this response?

If a language model suggested a detailed exercise plan for beginners looking


to lose weight, including types of exercises, frequency, and nutrition tips,
what could the generating prompt have been?

If a language model developed an educational project plan to teach


programming to children, including practical activities and teaching
resources, what type of prompt do you think was used?

If a language model generated a detailed evaluation of a new smartphone,


covering features, performance, and comparisons with previous models,
what type of prompt might have originated this analysis?

34
Combining
Everything
We’ve Learned
in this eBook_

35
Combining Everything We’ve Learned
in this eBook
Throughout this guide, we have explored a variety of techniques and strategies to
enhance our interactions with AI language models. Now, it is time to combine all this
knowledge and create truly powerful and effective prompts.

In this final chapter, I will demonstrate how to combine different elements of prompt
engineering to create complex and multifaceted instructions. We will see practical
examples that incorporate techniques such as “act as,” specifying tone and style,
using intermediate and advanced methods, and much more.

Remember: the art of prompt engineering lies in knowing when and how to apply
each technique to get the best results. It will not always be necessary to use all the
techniques in a single prompt, but understanding how they complement each other
will allow you to create richer and more productive interactions with AI models.

Example 1: Digital Marketing Plan

Act as a digital marketing expert (Role). Considering current trends in digital


marketing (Context), develop a strategic plan to increase social media
engagement for an e-commerce company (Task). In a professional and
informative tone (Tone and Style), provide a detailed analysis of the latest
trends, including practical examples of successful campaigns. Then, suggest
five specific strategies that can be implemented, detailing each one step by
step. Explain the logic behind each strategy and how it can be adapted to the
specific context of the company (Format).

The above prompt example incorporates the “act as” technique, specifies the desired
tone and style, uses a CTF (Context, Task, Format) structure, and implements a chain
of thought to obtain a detailed response.

36
Example 2: Market Analysis and Product Strategy

Act as a senior strategic consultant with over 20 years of experience in


market analysis and product development in the technology sector. Your
task is to analyze the current smartphone market and propose an innovative
strategy for a new product line.

Before you start, ask me the following questions to better understand the
context:

1. What is the primary target audience for this new line of smartphones?
2. Who are the main competing brands in the market?
3. Is there any emerging technology we should consider?

After receiving my answers, follow these steps:

1. Conduct a SWOT analysis of the current smartphone market, considering


the provided information.
2. Identify three main trends likely to shape the future of the smartphone
market over the next 5 years.
3. Propose an innovative concept for a new line of smartphones, explaining
how it differs from the competition and meets the target audience’s needs.
4. Develop a high-level strategic roadmap for the launch and marketing of
this new product.

Present your analysis and recommendations in a professional and confident


tone, suitable for an executive presentation. Use a clear structure with
subheadings for each section.

Finally, provide a concise summary of your main findings and


recommendations in no more than 100 words.

This second example combines several techniques:

ƒ Uses “act as” to define a specific role;


ƒ Implements “ask before answering” to obtain additional context;
ƒ Uses a nested prompt structure with clear steps;
ƒ Specifies the tone and style of the response;
ƒ Includes a request for a summary with a word limit.

37
Example 3: Creating Interactive Educational Content

Act as an educator specializing in space sciences with experience in creating


interactive content for high school students. Your task is to develop an
engaging lesson on space exploration.

Context: This lesson will be part of an online course and should be designed
to engage students aged 15 to 18.

Follow these steps to create the content:

1. Start with a captivating introduction that sparks students’ interest in the


topic of space exploration. Use a friendly and inspiring tone.
2. Develop the main body of the lesson, dividing it into three main sections:
a. History of space exploration
b. Current technologies and innovations
c. Future of space exploration and colonization of other planets

For each section, include:


- A clear and concise explanation of the main concepts
- An example or analogy related to teenagers
- An interactive question or mini-challenge to maintain engagement

3. Create an interactive timeline highlighting the major events in the history


of space exploration. Use the following structure for the timeline:

```
1957: Launch of Sputnik 1
1961: Yuri Gagarin, the first man in space
1969: Apollo 11 moon landing
1971: First space station, Salyut 1
1998: Establishment of the International Space Station (ISS)
2020: Launch of NASA’s Mars 2020 mission
2024: Planned Artemis mission to return humans to the Moon
```

CONTINUED ON THE NEXT PAGE

38
Briefly explain each event and its importance to space exploration.

4. Develop a practical activity that students can do at home to better


understand the physics of rockets, such as building a bottle rocket. Provide
step-by-step instructions.

5. Conclude the lesson with a summary of the main points and an inspiring
call to action, motivating students to become more interested in science and
technology.

6. Create five multiple-choice questions to assess students’ understanding of


the presented content.

Remember to keep the language accessible to teenagers, but without


oversimplifying scientific concepts. Use analogies and everyday examples to
make the content more understandable.

Finally, suggest three additional resources (such as documentaries, websites,


or apps) that students can explore to deepen their knowledge of space
exploration.

This third example brings together numerous techniques and lessons covered in this
eBook, such as:

ƒ Uses “act as” to define a specific role;


ƒ Specifies the tone and style of the response;
ƒ Provides context about the target audience, lesson objectives, and relevant
information to better guide the response;
ƒ Is structured clearly and concisely with numbered steps;
ƒ Uses examples and analogies;
ƒ Incorporates structured information and examples;
ƒ Uses the techniques “chains of thought” and “nested prompts”.

39
Final
Considerations_

40
Final Considerations

Reaching the end of this journey through prompt engineering, you now
possess an arsenal of knowledge and techniques that place you at the forefront
of interacting with AI systems. But remember: the true power of these skills only
manifests when you put them into practice.

It’s Time to Practice


Prompt engineering is not just a technical skill — it is an art that is perfected with
constant practice and creative experimentation. Each interaction with an AI language
model is an opportunity to refine your techniques, discover new approaches, and
expand the limits of what is possible to achieve.

I encourage you to dive headfirst into this new world of possibilities. Experiment
with different prompt structures, combine techniques, and don’t be afraid to dare.
The beauty of prompt engineering lies in its flexibility and the vast potential for
application in various fields.

Remember:

ƒ Each prompt is a learning opportunity.


ƒ Practice makes perfect — the more you experiment, the better you will become.
ƒ There is no single “correct” approach — creativity often leads to surprising
results.

Keep Learning
Your learning journey does not end here. To continue honing your skills and staying
updated with the latest trends and techniques in prompt engineering and artificial
intelligence, I invite you to explore additional resources:

Blog: Visit https://fvivas.com/en for in-depth articles, practical tips, and case
study analyses in prompt engineering. Regularly updated with fresh content and
valuable insights.

41
YouTube Channel: Subscribe to the channel https://youtube.com/@fvivascom
(only in Portuguese at the moment) for video tutorials, practical demonstrations, and
discussions on the latest innovations in AI and Prompt Engineering.

Thank you for embarking on this journey of discovery and innovation. I can’t wait to
see the incredible things you will achieve with your new skills in Prompt Engineering!

Fabio Vivas
AI Enthusiast and Author

Your Opinion Matters!


If this eBook brought you value, a review would be the best thank you!

By sending your feedback, you help me continue improving and offering high-quality
content.

Review here:
https://fvivas.gumroad.com/l/ebook-prompt-engineering-unveiled

Or here:
https://app.gumroad.com/reviews

42

You might also like