The API is great at pattern recognition and we can use this fact to speed up the task of writing XML. With the following prompt we are able to avoid the need to bracket tags and write closing tags. Spaces are used to denote nested relationships and a word and “:” are used to replace the closing and opening tags.

There are three main section to this prompt, separated with “###”:

  • An Instruction to “Convert the text to XML”

  • An example with tagged sections

  • An input section, to be edited by the user, to convert shorthand text to XML

The first step to creating this prompt is to think about our ideal input and output. In this case the input is as close to plain text as possible and the corresponding output we want is XML. By matching the terms in the instruction to the example and input section, we help the API understand three things:

  • Our output intent

  • What it needs to generate

  • How it should be formatting the content

Convert the text to XML.





name:Belgian Waffles


description:Two of our famous Belgian Waffles with plenty of real maple syrup



<?xml version="1.0" encoding="UTF-8"?>



<name>Belgian Waffles</name>



Two of our famous Belgian Waffles with plenty of real maple syrup








to: Tove



body:Don't forget me this weekend!


<?xml version="1.0" encoding="UTF-8"?>





<body>Don't forget me this weekend!</body>


Open this example in the Playground and try this yourself by replacing the second “[text]” section with your own. Remember to use spaces to denote nested relationships.

Did this answer your question?