Skip to main content

Prompt Engineering - Example-Driven Prompting

Apply this prompt engineering principle, Example-Driven Prompting or Few Shot Prompting or Give Examples, to get better prompt results and to boost your efficiency

Prompt Engineering Principle 7 - focuses on Example-Driven Prompting or Give Examples, also known as few-shot prompting. This involves providing the AI with specific examples or a structured format to follow, which helps guide the model towards producing the desired type of content or response. Here's how you can apply this principle in practice:

Example: Writing a Product Review

Without Principle 7 - Example-Driven Prompting or Give Examples or Few Shot Prompting:

Prompt: "Write a review for the latest model of the XYZ smartphone."

With Principle 7 - Example-Driven Prompting or Give Examples or Few Shot Prompting:

Prompt: "Write a review for the latest model of the XYZ smartphone. Here are some examples of points to cover: 

1. Camera Quality: Describe the resolution and special features like night mode.

2. Battery Life: Provide insights into the battery lifespan and charging speed. 

3. User Interface: Discuss the ease of navigation and availability of custom settings."

Example: Generating a Healthy Meal Plan 

Without Principle 7 - Example-Driven Prompting or Give Examples or Few Shot Prompting:

Prompt: "Create a 7-day healthy meal plan." 

With Principle 7 - Example-Driven Prompting or Give Examples or Few Shot Prompting:

Prompt: "Create a 7-day healthy meal plan. Here's the format to follow for each day: 

1. Breakfast: Include a protein source and a fruit. 

2. Lunch: Describe a balanced meal with protein, vegetables, and a whole grain.

3. Dinner: Suggest a light meal with lean protein and vegetables. 

4. Snacks: Provide two healthy snack options."

Example: Crafting a Technical How-To Guide 

Without Principle 7 - Example-Driven Prompting or Give Examples or Few Shot Prompting:

Prompt: "Explain how to set up a VPN on a home network." 

With Principle 7 - Example-Driven Prompting or Give Examples or Few Shot Prompting:

Prompt: "Explain how to set up a VPN on a home network. Follow this structure for the guide: 

1. Introduction: Briefly describe what a VPN is and its benefits for a home network. 

2. Requirements: List the necessary equipment and software. 

3. Step-by-Step Instructions: Provide detailed steps for setting up the VPN. 

4. Troubleshooting: Offer solutions for common issues encountered during setup." 

In each of these examples Principle 7 - Example-Driven Prompting or Give Examples or Few Shot Prompting is applied by including specific examples or a clear structure for the model to follow. This approach helps in guiding the model to produce content that is well-organized, comprehensive, and aligned with the user's expectations.

The prompt engineering principle, Example-Driven Prompting or Give Examples or Few Shot Prompting is part of the following group:

Providing Examples 

- Give Examples (7) 

- Repeat Key Phrases (18) 

- Give a Starting Phrase (20) 

Prompt Engineering Principles