- Prompt Warrior
- Posts
- How to improve your prompts with delimiters
How to improve your prompts with delimiters
Hey Warrior,
Have you ever had the feeling that as you're prompting an AI, it doesn't fully grasp what you want? Or that it's starting to mix up information?
It's frustrating.
You feel like you’ve provided so much information in your prompt, but the AI just isn't getting it right.
One reason this could be happening, is because you're not using delimiters in your prompts effectively.
Today, you'll learn:
What delimiters are exactly in the context of prompting
Why you should use them in your prompts to improve clarity and structure
How to use them to ensure the AI understands your instructions
Let's dive in!
Read time: 5 minutes
🧠 What are delimiters in the context of prompting and why should you use them?
Imagine you're an intern at a company, and your boss wants you to create a research report. Now your boss slams over a huge Excel sheet. It contains all the data you need, but all lumped together in one sheet:
Sales figures
Customer feedback
Market analysis
Competitor data
etc.
You’re trying to make sense of this jumble but it’s overwhelming and inefficient. And you end up making many mistakes in the report because of this.
Now, imagine instead that your boss had separate sheets for each type of information. One sheet for sales figures, another for customer feedback, a third for market analysis, and so on.
This way you can quickly locate the data you need for each part of your report. You don't have to sift through irrelevant information, and the structure helps you understand the relationships between different data points more clearly.
You can probably see where I’m going with this. In this example, each separate sheet acts like a delimiter.
And for the same reason, you should use delimiters in your AI prompts to separate different pieces of information.
If you don't use them, the AI might:
Struggle to understand the relationships between different pieces of information you provide
Mix up or confuse the various elements of your prompt
Misinterpret your instructions and produce irrelevant or incorrect outputs
By keeping information distinct and organized, delimiters make it easier for the AI to process, analyze, and understand your instructions. If you use them correctly, you will:
Make your prompts clearer and easier for the AI to follow
Get more accurate and relevant responses from the AI
Ensure the AI can easily differentiate between instructions, examples, and other types of information
Sound good?
Now let's get into how to use delimiters correctly in your prompts.
🤖 How to use delimiters in your prompts
Let's start with one of the simplest ways of using delimiters in your prompts:
Triple quotation marks (""")
I often use this if I only have a set of simple instructions and then need to provide additional information, such as examples or background information.
Here's an example (I’ll explain in a bit why I used this example, don’t get confused by it):
Summarize this text.
"""
Begin by reading the text carefully to grasp its main ideas and overall structure. Take notes on the key points, arguments, and conclusions presented in the text. Organize your notes into a logical outline that reflects the text's structure and hierarchy of ideas. Write a draft of your summary, focusing on the essential information and leaving out minor details or examples. Edit your draft for clarity, coherence, and conciseness, ensuring that your summary accurately represents the original text's content and tone. Proofread your final summary for any errors in grammar, spelling, or punctuation.
"""
As you can see the first line is the instruction. It is then followed by the text that should be summarized. But in this case, the text that should be summarized sounds like an instruction itself. So if I had left out the quotation marks, it might be unclear to the AI where the instruction exactly stops.
Ok, this was a simple example.
Now, what happens when your prompt gets bigger and more complex?
This is where my favorite way of using delimiters comes in:
Using XML tags
Here’s how an XML tags looks like…
<some label> your content </some label>
So you can basically put any label in brackets (<>), add your content in the middle, then close this with the same label in brackets, but now with a backslash (</>).
Pretty straightforward, right?
The benefits of XML tags are:
You can clearly label your sections
They let you clearly define a start and an end
Here’s an example (using my hook writer prompt):
<instructions>
You're an expert copywriter and have crafted hundreds of viral Twitter thread hooks.
Your job is to take my HOOK DRAFT provided below and turn it into 3 hooks each of the provided HOOK TYPES (so create 9 hooks in total).
The provided hook examples are just for you to understand the structure of the hook frameworks. The content of the examples is not important. It's also very important to adhere to the HOOK CONSTRAINTS when writing your hooks.
</instructions>
<hook_draft>
{Insert your hook draft}
</hook_draft>
<hook_constraints>
For the hooks you create, you have a few constraints:
- No hashtags
- Readability grade 7 or lower
- Every hook consists of less than 280 characters
- No emojis
- Use concise language
</hook_constraints>
<Hook Type 1: PAS>
<example1>
Do you sit at a computer for longer than 6 hours a day?
You're destroying your body if so.
Here's the setup you need to protect yourself from posture problems and crippling long-term injuries:
</example1>
<example2>
Most people suck at managing up.
They waste their boss' time with too much (or too little) information.
Here's how to give the right amount of context:
</example2>
</Hook Type 1: PAS>
<Hook Type 2: AIDA>
<example1>
Negotiating your salary is the fastest way to increase it.
But 99% of people don't know how.
With ChatGPT you have a your own salary negotiation coach.
Here's how to nail your next pay raise (using ChatGPT):
</example1>
<example2>
I spent over 500 hours in the last 6 months mastering ChatGPT.
Using prompt frameworks is by far the most effective way to level up your outputs.
Here are cheat sheets for the top 5 prompt frameworks to improve your prompts:
</example2>
</Hook Type 2: AIDA>
<Hook Type 3: Before and After Bridge>
<example1>
I used to be awful at sales.
Over time, I got better thanks to one simple framework.
I hope you find it valuable:
</example1>
<example2>
Adam Sandler now has a net worth of $440,000,000.
But 7 years ago, he was considered a washed-up failure.
Here's the story of the greatest career comeback no one is talking about:
</example2>
</Hook Type 3: Before and After Bridge>
If I hadn’t used delimiters in this prompt, the AI might have confused some things, because there is so much information.
Now you might be asking, what are some other examples where using delimiters are useful?
The general rule is to use delimiters for any distinct piece of information or instruction that you want the AI to treat separately.
Here are some more examples of sections you might want to separate with delimiters:
<instructions>
<background>
<constraints>
<examples>
<audience>
<format>
<tone>
💡 Wrapping Up
Today, we learned how using delimiters in your prompts can help improve the quality and accuracy of the AI's outputs.
Here's a quick recap:
Delimiters separate different pieces of information, making it easier for the AI to understand.
Triple quotation marks (""") work well for short, simple prompts.
XML tags are great for structuring complex prompts, letting you label sections and define their start and end.
Use delimiters for any distinct piece of information or instruction you want the AI to treat separately.
While prompts often work without delimiters, especially when they're short and simple, using them is still a helpful best practice.
It doesn’t just keep your prompt writing organized for yourself, but also ensures the AI can accurately understand and respond to your instructions, even as your prompts get more complex.
Thanks for reading!
If you enjoyed this, consider forwarding this newsletter to a friend or colleague.
What would you like me to write about in the next post? Reply to this email and let me know.
P.S. Did you miss the recent launch of the AI Growth Kit? Over 180+ entrepreneurs have joined. It’s a system of templates and prompts that lets you:
Create high-quality content in seconds
Without sounding like a generic robot
Grow your audience and business fast
Sign up to the waitlist here so you don’t miss the next time it’s available.
What did you think of today's email?Your feedback helps me create better emails for you! |
Reply