Template Based Prompting

Template-based prompting is a powerful tool for harnessing the capabilities of large language models (LLMs) by providing them with a structured framework for generating outputs. Think of it like giving your AI a pre-built house with defined rooms and functions, instead of just a pile of bricks. This approach improves clarity, consistency, and reduces the risk of off-topic responses.


Here's how template-based prompting works:

Visualizing Template-Based Prompting:

Let's say you want your LLM to write a product description for a new smartphone. Here's how you could use template-based prompting:

Template:

Introducing the [Product Name]!

Overview: This is a [category] designed for [target audience]. Its key features include [list of features].

Benefits:




Technical Specifications:




Call to Action: Learn more and purchase the [Product Name] today!


Result:

By filling in the blanks with specific details about your smartphone, you guide the LLM to generate a structured and informative product description, reducing the risk of irrelevant information or inconsistent formatting.


Benefits of Template-Based Prompting:


Challenges of Template-Based Prompting:


Overall, template-based prompting is a valuable technique for ensuring clear, consistent, and task-specific outputs from your LLM. By choosing the right template and customizing it thoughtfully, you can unlock the potential of your AI partner and achieve desired results effectively.

TBP Example-1: To Extract Product Details

Using ChatGPT3.5 

Using BARD

Prompt:

I am a Product Analyst and I am trying to extract Product information from a given Paragraph in the following format:
Product-Name: [Name of Product]

Features:

1) [Feature-1]

2) [Feature-2]

N) [Feature-N]

 

Technical Specifications:

1) [Specification-1]

2) [Specification-2]

n) [Specification-n]

 

While extracting the Product Information it should also follow below set rules:
a) The Details in "Features" and "Technical Specifications" should not repeat
b) Features should be mainly focused on Usability of the Product
c) Technical Specifications should be focused on the Technical aspects of the Product

For Example:

Input Paragraph is as follows: "Easy to grip. Satisfying to hold. With their unified design and satin finish, GPhone S24 feels as smooth as it looks. They're the upgrades you've waited for. More screen (7 Inch). More battery (6000mAh lithium-ion). More processing power (2.4GH 5nm processor) . There's so much more to love about Galaxy S24. A true pixel powerhouse that will not disappoint. Ever. Snap high-res pics for that will no doubt withstand the test of time for years to come. Search like never before with Circle to Search. Simply trace an object to get Google Search results. It's a new visual way to find what you're looking for. Get quick language translation on your next phone call. That's right, AI helps you communicate outside your own language while you talk on the phone. And get this, it even works on messaging."

Output is:

Product-Name: GPhone S24

Features:

1) Easy to Grip

2) Satisfying to hold

3) Unified Design and Satin Finish

4) To search just Circle the content and go for Search

5) Quick Language Translation

 

Technical Specifications:

1) More Battery - 6000mAh lithium-ion

2) More Screen size - 7 Inch

3) More Processing Power - 2.4GH 5nm processor

Now give the Product output for the following paragraph "GPhone S24 5G has 16.42 Centimeters (6.5-Inch) Super AMOLED Display, FHD+ Resolution, 1080 x 2340 Pixels Protected by Corning Gorilla Glass 5 50MP+8MP+2MP Triple Camera Setup - True 50MP No Shake Cam (F1.8) Main Camera + 8MP (F2.2) + 2MP (F2.4)| 13MP (F2.0) Front Camera 6000mAH Lithium-ion battery, 1 Year Manufacturer Warranty for Device and 6 Months Manufacturer Warranty for Inbox Accessories including batteries from the date of purchase 4 Generations of OS Upgrades and 5 Years of Security Updates Exynos 1280 Octa Core 2.4GHz with the 12 Band Support for a True 5G Experience"

Prompt:

I am a Product Analyst and I am trying to extract Product information from a given Paragraph in the following format:
Product-Name: [Name of Product]

Features:

1) [Feature-1]

2) [Feature-2]

N) [Feature-N]

 

Technical Specifications:

1) [Specification-1]

2) [Specification-2]

n) [Specification-n]

 

While extracting the Product Information it should also follow below set rules:
a) The Details in "Features" and "Technical Specifications" should not repeat
b) Features should be mainly focused on Usability of the Product
c) Technical Specifications should be focused on the Technical aspects of the Product

For Example:

Input Paragraph is as follows: "Easy to grip. Satisfying to hold. With their unified design and satin finish, GPhone S24 feels as smooth as it looks. They're the upgrades you've waited for. More screen (7 Inch). More battery (6000mAh lithium-ion). More processing power (2.4GH 5nm processor) . There's so much more to love about Galaxy S24. A true pixel powerhouse that will not disappoint. Ever. Snap high-res pics for that will no doubt withstand the test of time for years to come. Search like never before with Circle to Search. Simply trace an object to get Google Search results. It's a new visual way to find what you're looking for. Get quick language translation on your next phone call. That's right, AI helps you communicate outside your own language while you talk on the phone. And get this, it even works on messaging."

Output is:

Product-Name: GPhone S24

Features:

1) Easy to Grip

2) Satisfying to hold

3) Unified Design and Satin Finish

4) To search just Circle the content and go for Search

5) Quick Language Translation

 

Technical Specifications:

1) More Battery - 6000mAh lithium-ion

2) More Screen size - 7 Inch

3) More Processing Power - 2.4GH 5nm processor

Now give the Product output for the following paragraph "GPhone S24 5G has 16.42 Centimeters (6.5-Inch) Super AMOLED Display, FHD+ Resolution, 1080 x 2340 Pixels Protected by Corning Gorilla Glass 5 50MP+8MP+2MP Triple Camera Setup - True 50MP No Shake Cam (F1.8) Main Camera + 8MP (F2.2) + 2MP (F2.4)| 13MP (F2.0) Front Camera 6000mAH Lithium-ion battery, 1 Year Manufacturer Warranty for Device and 6 Months Manufacturer Warranty for Inbox Accessories including batteries from the date of purchase 4 Generations of OS Upgrades and 5 Years of Security Updates Exynos 1280 Octa Core 2.4GHz with the 12 Band Support for a True 5G Experience"

Product-Name: GPhone S24 5G

Features:

Technical Specifications: