Simple Delimiters

Simple delimiters separate different sections of your prompt, making it easier for the LLM to parse distinct parts and follow instructions accurately. Common delimiter options:
  • Single quotes: “TEXT”
  • Triple quotes: “”” TEXT ”””
  • Triple dashes: --- TEXT ---
  • Angle brackets: < TEXT >
Example with angle brackets: Summarize the text delimited by angle brackets into a single sentence.
< TEXT >

XML Tags

For more advanced structuring and complex prompts, you can incorporate XML tags. XML (eXtensible Markup Language) tags are used to define the structure and content of data. Structure of the tag:
  • Opening Tag: Marks the beginning of an element, enclosed in angle brackets (e.g., <name>).
  • Closing Tag: Marks the end of an element, similar to the opening tag but includes a forward slash (e.g., </name>).
  • Content: The data or text contained within the opening and closing tags (e.g., in <name>John Doe</name>, John Doe is the content).
Nested structure example: You can nest tags for hierarchical content. Prompt with XML tags:
<task>
    <instruction> </instruction>
    <document>
        <title> </title>
           <content>
            <paragraph id="1"> </paragraph>
        </content>
    </document>
</task>

When to Use Each

  • Use Delimiters for simple separation of sections, instructions, or examples within a prompt
  • Use XML Tags for complex, hierarchical structures or when you need to include metadata
Hint from Langdock: We recommend XML tags when creating templates that others will modify. While it takes more upfront effort, XML structure ensures consistency across your team and makes prompts much easier to share and reuse. Think of it as investing 10 minutes now to save hours later when scaling across your organization.