Prompting Techniques
πZero Shot Prompting: Introduction
If you don’t add any examples to your prompt, the model will be able to perform the task without any training. This is called zero-shot prompting.
Examples of Zero-Shot Prompting
Poetry Generation
Write a poem about love, using the words 'heart,' 'soul,' and 'passion.'
Code Generation
Write a Python code to find the factorial of a number. The input number will be provided as a string.
Language Translation
Translate this sentence from English to French: 'I love you.'
Movie Summary
Summarize the plot of the movie 'The Shawshank Redemption' in a few sentences.
Generating Clean Humor
Write a joke that is funny and appropriate for all audiences.
Creating a Catchy Tagline
Craft a catchy tagline for a new eco-friendly cleaning product.
One Shot Prompting
If you add only one example to your prompt, the model will be able to perform the task with only one example. This is called one-shot prompting.
Examples of One-Shot Prompting
Write a poem about love, using the words 'heart,' 'soul,' and 'passion.'
Example:
Roses are red,
Violets are blue,
With all my heart,
I love you.
Write a Python function to calculate the factorial of a number, considering the input as a string.
Example:
def factorial(n: int) -> int:
if n == 0:
return 1
else:
return n * factorial(n - 1)
Translate the sentence from English to French: 'I love you.'
Example: 'Hello, world!' in French is 'Bonjour, monde!'
Few Shot Prompting
If you add only a few examples to your prompt, the model will be able to perform the task with only a few examples. This is called few-shot prompting.
Examples of Few-Shot Prompting
English: Dog β Spanish: Perro
English: Cat β Spanish: Gato
English: Hello β Spanish: ?
5 + 10 = 15
7 * 6 = 42
9 / 3 = ?
10 miles to km = 16.09 km
5 feet to meters = 1.524 meters
20 pounds to kg = ?
2023-08-17 β August 17, 2023
2021-12-01 β December 01, 2021
2023-05-15 β ?
Your task is to answer in a consistent style:
Son: Dad, what is motivation?
Dad: Motivation is when you get something you want.
Son: Dad, what is inspiration?
Ask Before Answer Prompting
Ask before answer prompting is a prompting technique where you ask a question before answering it. This is called ask before answer prompting.
Examples: Ask Before Answer Prompting
Write a poem:
Before answering, I want you to first ask for any extra information that helps you produce a better answer. If you got no questions, please provide the answer instead.
You are an experienced travel blogger with a focus on destinations for nature and activity lovers.
Your goal is to write a blog post about the best place in California for refreshment.
The post should be no longer than 750 characters and target a board audience that goes beyond divers or nature enthusiasts.
Before answering, I want you to first ask for any extra information that helps you produce a better answer. If you got no questions, please provide the answer instead.