Module - 2
Module - 2
Module 2
Chapter :01 Introduction to Prompt Engineering
1. Define Prompt Engineering and explain its components with an example
Definition:
Prompt engineering is the art and science of designing input instructions (prompts) that
guide Large Language Models (LLMs) such as ChatGPT to produce accurate, creative, and
context-appropriate outputs.
A prompt serves as a roadmap that establishes context, specifies the task, and provides cues
or constraints to influence how the AI responds.
Components:
1. Instruction– Describes what the model must do (e.g., “Summarize,” “Translate,”
“Classify”).
2. Context– Gives relevant information or scenario details to anchor the model’s
reasoning.
3. Input Data /– States the specific query or content on which the model must act.
4. Output Format– Specifies tone, structure, or style expected in the answer.
Example:
Prompt → “Summarize the following paragraph in three bullet points, highlighting the main
causes of climate change.”
SJCIT
1
Introduction to Artificial Intelligence Module 2
Here, the instruction (“Summarize”), context (“causes of climate change”), and format
(“three bullet points”) together ensure a precise, structured response.
2. What Makes Prompt Engineering Vital?
Prompt engineering is crucial because it enables us to achieve the best possible results
from Large Language Models (LLMs) like ChatGPT.
It enables users to control how the AI behaves, making it useful for various creative and
practicalpurposes.
The main reasons why prompt engineering is vital are:
3. How can prompt engineering make advanced AI systems more accessible to non-
technical users?
Prompt engineering democratizes AI by enabling anyone—without coding or data science
expertise—to interact with LLMs using plain language.
SJCIT
2
Introduction to Artificial Intelligence Module 2
Thus, prompt engineering bridges the gap between human intent and AI capability,
expanding AI’s reach to a wider audience.
Each type serves a specific purpose, but all aim to guide the Large Language Model
(LLM) to generate accurate, relevant, and well-structured outputs.
1. Natural-Language Prompts
These are prompts written in simple, everyday language, just like how humans
communicate naturally to make AI understand instructions clearly and respond in a
natural, human-like manner.
Example:
“Explain Newton’s laws in simple words.”
This prompt uses plain English, so the AI understands that it must provide a simple
explanation suitable for beginners.
Natural-language prompts are best for writing, teaching, summarizing, and general
question–answer tasks because they don’t require any coding or special format.
2. System Prompts
These are predefined or hidden instructions given to the model to that guide how
an AI model should behave, speak, and respond - control its tone, role, or behavior
throughout a session.
They act like “rules” that guide how the model should communicate but these
instructions are not visible to the user during the conversation
To maintain consistency and control in how the AI responds, especially in
professional or formal settings.
Example:
System Prompt:
“You are a polite and empathetic customer-service assistant. Always greet the user,
answer questions clearly, and offer to help further if needed.”
Effect on AI Behavior:
Responds warmly.
Uses polite tone.
Avoids slang or rude language.
SJCIT
3
Introduction to Artificial Intelligence Module 2
System prompts are widely used in chatbots, customer service bots, and digital
assistants, ensuring the model’s responses stay polite, factual, and professional.
3. Conditional Prompts
Conditional prompts include specific conditions or logic statements that tell the AI
what to do based on a situation or input.
They often use “if–then” structures.
To help the model adapt its response depending on the given context or data.
Example:
Customer Support Bot
Conditional Prompt:
“If the user mentions refund, explain the refund policy. If they mention delivery,
provide delivery tracking details.”
Behavior:
Input: “How do I get a refund?” → Output: “You can request a refund
within 7 days of delivery…”
Input: “Where is my package?” → Output: “Here’s your delivery tracking
link…”
Steps to follow :
SJCIT
4
Introduction to Artificial Intelligence Module 2
You must decide what type of output you expect — for example, a summary, a
poem, a translation, or a code snippet.
Understanding the task helps the engineer frame the prompt that directs the
model correctly.
Example: If the goal is to generate a news headline, the prompt should specify
“Write a short, catchy headline for the given news paragraph.”
5. Evaluate Performance
After testing, evaluate how well the prompt performs in terms of:
o Accuracy – Is the information correct?
o Creativity – Is the output original or insightful?
o Coherence – Is the response logical and well-structured?
Based on evaluation, further refinements can be made to improve results.
SJCIT
5
Introduction to Artificial Intelligence Module 2
SJCIT
6
Introduction to Artificial Intelligence Module 2
EXS :
Why: The revised prompt removes gender bias and promotes fairness.
SJCIT
7
Introduction to Artificial Intelligence Module 2
1. Improves Accuracy and Control: Carefully written prompts help LLMs give
precise and factual answers, reducing errors and confusion.
2. Enhances Creativity: Prompts inspire AI to generate new ideas, stories, and artistic
or innovative content.
3. Saves Time and Effort: Natural-language prompts allow users to complete complex
tasks quickly without coding.
4. Accessible to Non-Technical Users: Anyone can use AI easily through simple
language, making technology more user-friendly.
5. Personalization and Ethical Use: Prompts can be designed to produce responses in
a desired tone or style while avoiding bias or misuse.
SJCIT
8
Introduction to Artificial Intelligence Module 2
Example:
“Write a short poem about nature.”
The model uses its existing knowledge of poetry and nature to create an answer.
Suitable for creative writing, summarization, and question answering, where specific
examples are not required.
MORE EXS :
Classification
Prompt: “Classify the sentence ‘I love this new phone!’ as Positive, Negative, or Neutral
sentiment.”
Output: Positive
Rewriting / Paraphrasing
Prompt: “Rephrase the sentence: ‘AI is changing the world.’”
Output: “The world is being transformed by AI.”
2. One-Shot Prompting
The model is given one example before performing the task. This single example
helps the model understand the expected style, tone, or structure.
Helps improve the accuracy and relevance of responses when a small hint or pattern is
provided.
Example:
Translate ‘Bonjour’ → ‘Hello’. Now translate ‘Au revoir’.”
After seeing one translation, the model easily follows the same pattern.
Useful for translation, classification, and short text generation tasks, where one
example is enough to guide the output format.
MORE EXS :
Grammar Correction
Prompt:
Example: “he go to school every day.” → “He goes to school every day.”
Text: “she play piano very well.” → ?
Output: “She plays piano very well.”
SJCIT
9
Introduction to Artificial Intelligence Module 2
Input: “banana” → ?
Output: “BANANA”
3. Few-Shot Prompting
The model is provided with a few (2–5) examples before being asked to perform the
main task.
It helps the model learn the pattern, logic, or structure of responses by studying
examples.
Example:
Giving multiple math problem–solution pairs and then asking the model to solve
a new one helps it follow the same reasoning.
Ideal for complex reasoning tasks, question answering, sentiment analysis, and data
formatting, where pattern recognition is needed.
MORE EXS :
Sentiment Analysis
Prompt:
Text: “I love this movie.” → Sentiment: Positive
Text: “This product is terrible.” → Sentiment: Negative
Text: “The experience was amazing.” → Sentiment: Positive
Text: “The service was not good.” → Sentiment: Negative
Text: “The food was delicious.” → Sentiment: ?
Output: Positive
4. Self-Consistency Prompting
The model is asked to generate multiple reasoning paths for the same question
and then select or average the most consistent and logical answer.
To improve reasoning accuracy and reduce random or incorrect outputs.
SJCIT
10
Introduction to Artificial Intelligence Module 2
Example:
In solving a logic problem, the model may generate several solutions and then choose
the one that appears most frequently or is logically sound.
Helpful in analytical writing, problem-solving, decision-making, and reasoning-based
tasks, ensuring the final output is consistent and reliable.
MORE EXS :
2. Analytical Writing
Prompt: “What are the main causes of climate change?”
Path 1: Greenhouse gas emissions, deforestation, industrial pollution.
Path 2: Greenhouse gases, land-use change, burning fossil fuels.
Path 3: CO₂ emissions, deforestation, fossil fuels.
Common consistent elements → greenhouse gases, deforestation, fossil fuels.
Summary Table
SJCIT
11
Introduction to Artificial Intelligence Module 2
10. Describe the categories of prompts in the Prompt Gallery and explain how they
support different NLP tasks.
The Prompt Gallery is a curated collection of prompts that helps users guide NLP models
like ChatGPT to perform specific tasks effectively. Each category targets a particular
NLP application:
1. Text Generation Prompts
Explanation: These prompts instruct the model to create original text in a specific style
or format. They can generate stories, essays, product descriptions, or poetry. Users can
define the tone, length, and style of the output.
Example: “Write a motivational paragraph encouraging students to study consistently.”
Support for NLP Tasks: Facilitates creative writing, automated content creation, and
storytelling applications.
SJCIT
12
Introduction to Artificial Intelligence Module 2
SJCIT
13
Introduction to Artificial Intelligence Module 2
SJCIT
14
Introduction to Artificial Intelligence Module 2
SJCIT
15
Introduction to Artificial Intelligence Module 2
11. How can unlocking imagination and innovation lead to cr eative br eakthr oughs in
pr oblem-solving and new ideas?
Innovation starts with imagination — the ability to see what doesn’t exist yet.
1. Encourage Brainstorming:
Keep sharing ideas freely — no idea is too small or silly. The more ideas, the better!
2. Embrace Failure:
Every mistake teaches something new. Don’t fear failure; learn and improve from it.
Ask why and what if often. Try experiments, explore new tools, and see what happens.
Great ideas come when people from different fields share their knowledge — engineers,
designers, doctors, artists, all together!
5. Value Diversity:
Different backgrounds bring fresh thinking. Everyone sees problems differently — that’s how
new ideas are born.
Stay open to change. Read, explore, and adapt to new technologies and trends.
Clear goals give direction, but freedom gives creativity. Recognize people who take initiative.
SJCIT
16
Introduction to Artificial Intelligence Module 2
12. What ar e the top 10 pr ompts that can help unlock imagination and inspir e
innovation?
These prompts help students and professionals think beyond the usual and spark creative
ideas that can lead to innovation.
5. Sense of Wonder
Curiosity opens the door to discovery.
SJCIT
17
Introduction to Artificial Intelligence Module 2
Example:
Wright Brothers: Their curiosity about how birds fly led to the invention of the airplane.
A prompt for effective writing or a writing prompt is a short idea, question, or instruction that
helps to start writing. It gives direction when you don’t know what to write about and helps
you think creatively or clearly.
SJCIT
18
Introduction to Artificial Intelligence Module 2
Writing prompts help to Get new ideas, Practice different writing styles, Express thoughts
and emotions freely. ️
13. What ar e the differ ent types of wr iting pr ompts, and how does each type help
impr ove wr iting skills?
ANS..
Example: “You wake up one morning and find you can talk to animals. What happens next?”
Example: “Describe your favorite place in nature — what do you see, hear, and feel?”
Example: “How would you reduce plastic waste in your college campus?”
4. Reflective Writing Prompts – Help us explore your own thoughts and experiences.
Example: “Write about a time you faced failure and what it taught you.”
Example: “Should students have a four-day school week? Explain your view.”
14. How can wr iting pr ompts help ignite the wr iting pr ocess and make it easier to star t
and develop ideas?
ANS.
Writing prompts are small ideas or questions that help you start writing.
They spark imagination, guide your thoughts, and make writing easier — especially when
you feel stuck.
1. Encourages Creativity
Prompts help us imagine new ideas and begin writing with excitement.
SJCIT
19
Introduction to Artificial Intelligence Module 2
Example: “Write a dialogue between two strangers meeting for the first time.”
4. Enhances Expression
6. Builds Confidence
***************************************************************************
SJCIT
20
Introduction to Artificial Intelligence Module 2
SJCIT
21