Thoughts Brewing Blog

AI Quick Tips 25: Use delimiters in your text prompts

Written by Damien Griffin | Jul 6, 2024 11:15:00 AM

A delimiter is simply a boundary.  They are used to separate individual characters, words, URLs, and all kinds of data.  

As a quick example, here are a few ways I could use delimiters for the numbers 1 - 10:

  • I could use the letter “a”
    • 1a2a3a4a5a6a7a8a9a10
  • That’s hard to read so I could use commas
    • 1,2,3,4,5,6,7,8,9,10
  • I could also use semicolons
    • 1;2;3;4;5;6;7;8;9;10


I could use whatever I want as long as it is consistent, identified, and not used anywhere else (you’d need escape characters, and it can get messy and hard to read… I digress)


If you are using a text prompt (as opposed to a voice prompt, image prompt, etc.), consider using delimiters to identify parts of the prompt that should be treated differently.  This allows you to write clear instructions for both the AI tool and other people that might read the prompt (think templates…)


The following examples are taken directly from OpenAI’s prompt engineering strategy guide for ChatGPT

  1.  

  1.  

  1.  


You could make a strong case that the delimiters don’t help much in prompts this short and straightforward.  While true, I think that it is good to build the habit with simpler examples so that it will be second-nature when there are more complex tasks .