UPE03 - Creating Structured Prompts to Share with Your Team
In this learning unit, we explore how to write structured prompts that are easy to read, maintain, and share with your teammates.
🚀 Learning Objectives
Examine sample structured prompts and understand the benefits they provide for guiding AI assistants to deliver tailored outputs.
Discover the COSTAR prompt structure, a proven framework used by award-winning AI.
Discover role-based prompt formulation.
See how structured prompts help teams maintain a neat library of prompts, and understand the importance of building and managing a prompt library.
Writing Structured Prompts with Delimiters
Some people write prompts like writing code. Here's an example.
-- Prompt Starts ---
### Task Description ###
You are tasked with writing a product description for a new line of organic
skincare products. Your description should highlight key benefits,
ingredients, and unique selling points to attract potential customers.
### Product Line ###
[Insert product line here]
### Required Sections ###
Please include the following sections in your product description:
1. Introduction: Provide an enticing introduction to capture the reader's attention.
2. Key Benefits: List and describe the main benefits and advantages of using the skincare products.
3. Ingredients: Provide detailed information about the key ingredients and their benefits.
4. Unique Selling Points: Highlight what makes these products stand out from competitors.
5. Conclusion: Conclude with a compelling call-to-action encouraging readers to try the products.
### Formatting Instructions ###
- Use bullet points or numbered lists for easy readability.
- Ensure proper grammar, punctuation, and spelling throughout the description.
- Keep the tone engaging and persuasive to appeal to potential customers.
--- Prompt Ends ---
There's really no fixed convention in what delimiters you should use or how to structure the prompt. (Though, OpenAI tried to provide some suggestions). You can define your own convention.
Why?
Segment the Prompt: divide the prompt into distinct sections. This segmentation helps the model understand the different components of the task better.
Specify Input Fields: define fields or placeholders within the prompt where specific information or variables should be inserted by prompt user.
Reusability: By using a consistent format for your prompts, you can more easily reuse or share the prompt, or adapt them for different scenarios.
COSTAR Prompt Structure
This tip comes from someone who won Singapore’s GPT-4 Prompt Engineering Competition in 2023 [ref]. The COSTAR framework is a proven approach to crafting structured prompts that guide AI assistants to deliver tailored, high-quality outputs. It's perfect for asking an AI assistant to write something for you.
COSTAR stands for:
(C) Context
Establishing the background information is crucial for AI to understand the specific scenario being discussed.
(O) Objective
Clearly defining the task or goal you want AI to perform helps it focus its response on meeting that specific requirement.
(S) Style
Specifying the desired writing style guides AI to respond in a manner and choice of words aligned with your needs.
(T) Tone
Setting the intended attitude or emotional context of the response ensures AI's output resonates with the required sentiment.
(A) Audience
Identifying the intended audience for the response allows AI to tailor its output to be appropriate and understandable in the given context.
(R) Response
Providing the desired response format ensures the language model outputs the information in a format that can be easily used for downstream tasks or manipulations.
This is the author's example (not mine!)
# CONTEXT #
I want to advertise my company’s new product. My company’s name is Alpha and the product is called Beta, which is a new ultra-fast hairdryer.
# OBJECTIVE #
Create a Facebook post for me, which aims to get people to click on the product link to purchase it.
# STYLE #
Follow the writing style of successful companies that advertise similar products, such as Dyson.
# TONE #
Persuasive
# AUDIENCE #
My company’s audience profile on Facebook is typically the older generation. Tailor your post to target what this audience typically looks out for in hair products.
# RESPONSE #
The Facebook post, kept concise yet impactful.
Context: ฉันเป็นตัวแทนฝ่ายขายของบริษัท XYZ ที่จำหน่ายผลิตภัณฑ์อุปโภคบริโภคที่เป็นมิตรกับสิ่งแวดล้อม ฉันช่วยลูกค้าในการเลือกซื้อสินค้าที่เหมาะกับความต้องการและมุ่งเน้นไปที่การใช้ผลิตภัณฑ์ที่เป็นมิตรกับสิ่งแวดล้อม
Objectives: เขียนอีเมล 3-4 ย่อหน้าถึงลูกค้าที่มีศักยภาพ เพื่ออธิบายถึงประโยชน์หลักของชุดผลิตภัณฑ์ดูแลบ้านจาก XYZ และเชิญชวนให้พวกเขาสั่งซื้อสินค้าหรือเยี่ยมชมเว็บไซต์ของเรา
Style: สนทนาและให้ข้อมูล โดยหลีกเลี่ยงศัพท์เทคนิคที่ซับซ้อน
Tone: เป็นมิตร เข้าอกเข้าใจ และมุ่งเน้นไปที่ความต้องการและความกังวลของลูกค้า
Audience: ลูกค้าที่มีศักยภาพอายุ 25-45 ปี ที่สนใจในผลิตภัณฑ์ที่เป็นมิตรกับสิ่งแวดล้อมและต้องการพัฒนาคุณภาพชีวิตด้วยผลิตภัณฑ์ที่ดีต่อสุขภาพและสิ่งแวดล้อม
Role-Based Prompt Formulation
While the COSTAR framework provides a solid foundation for structuring prompts for writing assistant, there are other alternative structures that may better suit your team's needs.
The following structure is a well-established in prompt engineering community (though the origin is unknown). It is designed to fit scenarios where you want the AI to play a specific role, such as a customer service representative, subject matter expert, or creative writer, and provide detailed guidance to ensure the AI's output aligns with your unique requirements.
Here's the prompt structure:
Role: Establish the persona or identity the AI should adopt when generating the response.
Context: Provide background information about the situation, scenario, or business need you're addressing.
Instructions: Clearly define the task, objective, or actions you want the AI to perform.
Format: Specify the desired output format, such as a report, email, or bullet-point list.
Examples: Include sample text or outputs that illustrate the expected quality and style.
Constraints: Outline any limitations or guidelines the AI should follow, such as avoiding sensitive topics or maintaining a professional tone.
Example:
Role: You are a Marketing Specialist at XYZ Company, tasked with creating a product launch plan.
Context: XYZ Company is preparing to launch a new eco-friendly cleaning product line. The launch is scheduled for next month, and we need to ensure that the product is introduced effectively to our target market. The product line includes an all-purpose cleaner, glass cleaner, and bathroom cleaner, all of which are designed to be environmentally friendly and highly effective.
Instructions: Prepare a comprehensive product launch plan that covers the following:
- Marketing Strategy: Outline strategies for promoting the new product line, including digital marketing, social media campaigns, and influencer partnerships.
- Sales Channels: Identify and describe the sales channels where the products will be available, such as online stores, retail partners, and direct-to-consumer sales.
- Target Audience: Define the target audience for the product line and explain how the marketing plan will address their needs and preferences.
- Launch Timeline: Create a timeline for key milestones leading up to the product launch, including pre-launch promotions, the official launch date, and post-launch follow-up.
- Key Performance Indicators (KPIs): Specify the KPIs that will be used to measure the success of the product launch, such as sales targets, website traffic, and social media engagement.
Format: Provide the launch plan in a clear, easy-to-follow bullet-point format or structured report.
Examples: [Include sample product launch plans or marketing strategies from previous launches]
Constraints: Keep the tone professional and engaging, avoiding overly technical jargon. Ensure all strategies are feasible and aligned with company goals.
Note: for both COSTAR and role-based prompts, you don’t need to include every component. Sometimes ‘audience’ won’t be relevant or you won’t have any ‘constraints’ in mind. Use only the ones you think make sense.
Building a Prompt Library for Your Team
Creating a centralized prompt library is a game-changer for teams to level up with Generative AI. You maximize each others' productivity.
This can be as simple as sharing an Excel spreadsheet or a shared document containing prompts from all team members, categorized by use cases or any other relevant criteria to make them easy to browse and retrieve. Maybe include sample outputs alongside each prompt to illustrate the expected results.
Encourage your team members to do it with you.
Example:
Marketing team: prompts for crafting social media posts, email newsletters, and website copy
IT department: prompts for generating technical documentation, troubleshooting guides, and user onboarding materials
Legal team: prompts for drafting contracts, policy statements, and regulatory reports
Key Lessons Learned
Structured prompts, such as the COSTAR and role-based frameworks, provide a powerful means of guiding AI assistants to deliver tailored, high-quality outputs that meet specific needs.
Writing structured prompts help you and AI understand tasks at hands better.
Maintaining a centralized prompt library, with prompts categorized by department and use case, helps teams streamline AI-powered workflows, ensure consistency.
Last updated