Mastering the Art of Prompting

Suraj PatelSuraj Patel
4 min read

Prompting in AI refers to the process of giving instructions or input to an AI model (like ChatGPT) so it knows what you want it to do.

In simple terms:
➡️ You give a prompt (a message, question, or command)
➡️ The AI responds based on that input

  1. Zero Shot Prompting

Zero-shot prompting is a technique where you ask the model to perform a task without giving it any example of how the task should be done. You only give an instruction or question, and the model uses its pre-learned knowledge to respond.

Example: Translate to Hindi

The weather is very pleasant today.

Response you get: आज मौसम बहुत सुहावना है।

You gave no examples of how translations are done. You simply told the model what to do — that’s zero-shot prompting.

  1. Few Shot Prompting

Few-shot prompting is a prompting technique in AI where you give the model a few examples of the task you want it to perform before asking your actual question or input. It helps the model understand the pattern or structure you expect in the response

Example: Translate English to Hindi.

Input: Hello

Output: नमस्ते

Input: How are you?

Output: आप कैसे हैं?

Input: What is your name?

Output:

Model learns the pattern and will output: "आपका नाम क्या है?"

  1. Chain-of-Thought (CoT) Prompting

Chain-of-Thought (CoT) Prompting is a technique where you ask the model to explain its reasoning step by step before giving the final answer. This helps the model "think aloud", leading to more accurate and logical answers—especially for math, logic, or reasoning-based tasks.

Example : Math Problem

Q: A train travels 60 km in 1 hour, then 90 km in 1.5 hours. What is the average speed?

Let's think step by step.

First, find the total distance: 60 + 90 = 150 km
Then, find total time: 1 + 1.5 = 2.5 hours
Average speed = Total distance / Total time = 150 / 2.5 = 60 km/h
Final Answer: 60 km/h

  1. Self Consistency Prompting

Self-Consistency Prompting is an advanced version of Chain-of-Thought (CoT) prompting where the model is asked to generate multiple reasoning paths, and then the most consistent answer among them is chosen as the final output.

Example: Math Problem

Q: A library has 5 shelves. Each shelf holds 12 books. How many books are there?

Let's think step by step.

🧠 Path 1:

5 shelves × 12 books = 60 books
✅ Final Answer: 60

🧠 Path 2:

Each shelf has 12 books. So 5 shelves will have 12 + 12 + 12 + 12 + 12 = 60 books.
✅ Final Answer: 60

🧠 Path 3:

Multiply the number of shelves and books per shelf: 5 × 12 = 60
✅ Final Answer: 60

Now we see all paths lead to 60, so:

🎯 Self-Consistent Answer: 60

  1. Instruction Prompting

Instruction Prompting is the simplest and most direct prompting method, where you clearly describe the task you want the model to perform — like giving it a command or instruction.

Example

Write a Python function to check if a number is prime.

  1. Direct Answer Prompting

Direct Answer Prompting is the most minimal and straight-to-the-point style of prompting.

You simply ask a question or give a command, and the model is expected to respond with the final answer only, without any explanation or reasoning.

Example: General Question

Prompt: What is the capital of France?

Output: Paris

  1. Persona-Based Prompting

Persona-based prompting is when you instruct the model to take on a specific role, identity, or personality while generating responses. This makes the answers more contextual, consistent, and human-like depending on who the model is "pretending" to be.

Example: Prompt (Persona Programmer)

Input:You are a JavaScript developer. Explain what a for loop does.

🟢 Output:
A for loop lets you run the same code again and again, until a condition is no longer true. It's great when you want to repeat something a specific number of times.

  1. Contextual Prompting

Contextual Prompting means giving the AI extra background information or conversation history so it understands the situation or context before answering your question or request.

Example

Prompt:
My brand sells eco-friendly bags online. We focus on sustainability and style. Suggest a tagline for our homepage.

👜 Output:
"Carry Style. Leave Footprints of Change."
—or—
"Eco Meets Chic – Bags That Care."

  1. Multimodal Prompting

Multimodal prompting means giving the AI inputs in multiple formats, like:

  • 📝 Text

  • 🖼️ Images

  • 🔊 Audio

  • 📹 Video (future use)

The model processes two or more types of data together to understand the full context and give better responses.

Example: Image + Instruction

Prompt:

Text: Solve the math problem shown in the image.

Output:

The image shows the equation 3x + 2 = 11.

Solving: 3x = 9 → x = 3

0
Subscribe to my newsletter

Read articles from Suraj Patel directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Suraj Patel
Suraj Patel