Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Example-Based and Step-by-Step Prompting | Techniques and Strategies
Prompt Engineering Basics

bookExample-Based and Step-by-Step Prompting

Example-based prompting involves showing the AI one or more examples of the desired output. This is called few-shot prompting.

Note
Definition

Few-shot prompting: supplying a few examples in the prompt to demonstrate the desired output.

For complex or multi-step tasks, chain-of-thought prompting encourages the AI to reason step by step.

Note
Definition

Chain-of-thought prompting: encouraging the AI to reason through a problem step by step in its response.

Example comparison

  • Few-shot: Translate the following sentences to French. Example: "Good morning." β†’ "Bonjour." Now translate: "How are you?";
  • Chain-of-thought: Solve this math problem step by step: If a train travels 60 miles in 1.5 hours, what is its average speed?.

Use few-shot prompting when you want the AI to mimic a specific style or format. Use chain-of-thought prompting for tasks that require logical steps or explanations.

Note
Note

Too many examples can overwhelm the AI or exceed its context window. Choose concise and relevant examples.

question mark

When should you use chain-of-thought prompting?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 2

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Awesome!

Completion rate improved to 11.11

bookExample-Based and Step-by-Step Prompting

Swipe to show menu

Example-based prompting involves showing the AI one or more examples of the desired output. This is called few-shot prompting.

Note
Definition

Few-shot prompting: supplying a few examples in the prompt to demonstrate the desired output.

For complex or multi-step tasks, chain-of-thought prompting encourages the AI to reason step by step.

Note
Definition

Chain-of-thought prompting: encouraging the AI to reason through a problem step by step in its response.

Example comparison

  • Few-shot: Translate the following sentences to French. Example: "Good morning." β†’ "Bonjour." Now translate: "How are you?";
  • Chain-of-thought: Solve this math problem step by step: If a train travels 60 miles in 1.5 hours, what is its average speed?.

Use few-shot prompting when you want the AI to mimic a specific style or format. Use chain-of-thought prompting for tasks that require logical steps or explanations.

Note
Note

Too many examples can overwhelm the AI or exceed its context window. Choose concise and relevant examples.

question mark

When should you use chain-of-thought prompting?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 2
some-alt