How to Use Delimiters to Structure Prompts
Delimiters
are characters or strings (multiple characters) used to clearly separate and structure information within a prompt.
Below is an example of structuring a prompt into blocks using the ###
delimiter to separate the instructions, context, and input data.
### Instructions Summarize the following news article in one sentence. ### Context The summarized sentence will be used as a meta tag for search engine optimization (SEO). ### Input Data The rapid advancement of generative artificial intelligence (AI) technology is driving innovative changes in the media, entertainment, and education sectors. In particular, generative AI is making strides in the fields of natural language processing and image generation... (omitted)
Just as a well-structured text is easier to read, AI also prefers prompts where the context is clearly structured over those that are listed linearly.
Commonly Used Delimiters
Delimiters can vary from prompt to prompt and do not have fixed meanings.
However, the most commonly used delimiters in prompt engineering and their typical roles are as follows.
1. [###]
Used to indicate a major heading in the prompt.
Often used to denote the title of an information block or the beginning of a section in the prompt.
### Request Please develop a marketing strategy to increase revenue. ### Reference Data - Q1 2022 Revenue - Q2 2022 Revenue ...
The #
symbol doesn't have to be used strictly three times, as different levels of headings can be indicated with #
(main heading), ##
(subheading), ###
(sub-subheading), etc.
# What is a Prompt? ## Components of a Prompt ### Instructions ### Context
2. ["""]
Used to enclose long quotations or special multi-line information that requires emphasis, as well as to distinguish context.
Double quotes "word"
can also be used to highlight specific parts.
Which philosopher is quoted below? """ I think, therefore I am. """
Please recommend "3" overseas travel destinations for this summer.
Summarize the article above in one sentence. """Present the summary here"""
3. [---]
Used to visually separate different parts of the prompt.
This helps to clearly delineate each section for easier understanding of the information.
Please correct the following sentence --- I am glad to here that you are doing well.
Combining Delimiters
Delimiters can be mixed and used together as shown below.
### Section 1 """ This contains the content for section 1. """ --- ### Section 2 """ The following is the content for section 2. The AI recognizes this part as an independent unit. """
In this prompt, ###
is used to separate the titles of sections, """
is used to enclose the content of each section, and ---
visually separates each section.
In addition to these three delimiters, various other delimiters can be used depending on the purpose of the prompt.
Please correct the English sentence below and explain at least two points of correction. * Original Sentence: I am student who live in New York. Who is you? * Corrected Sentence: <Corrected Sentence> 1. <Correction Point 1> 2. <Correction Point 2> 3. [Additional Correction Points]
In this prompt, ***
is used to separate the sentence to be corrected, and < >
are used to indicate the corrected sentence and correction points.
Practice
Compare responses from a structured prompt using delimiters and an unstructured prompt without delimiters.
### Request I plan to travel in Paris for one day. Considering the limited time, please recommend 3 places to visit in one day. --- ### Response Format [1] <Recommended Place 1> : <Reason for Recommendation> [2] <Recommended Place 2> : <Reason for Recommendation> [3] <Recommended Place 3> : <Reason for Recommendation>
Please recommend places to visit in Paris.
Delimiters are characters or strings used to distinguish between the previous prompt and the next.
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help