๐Ÿ“š Advanced

5. Advanced Structures

Mastering delimiters, XML tags, and structured outputs (JSON/Markdown) for reliable results.

Delimiters & Structured Output

To build reliable apps, you need to separate your instructions from your data and control the output format.

1. Delimiters

Use special characters to prevent "Prompt Injection" and help the model know what to process.

Summarize the text delimited by triple quotes.

Text: """
[Insert long article here]
"""

Common Delimiters

Triple quotes: """
Triple backticks: ```
XML tags: <text>
Dashes: ---

2. Structured Output (JSON)

If you are building an app, you almost always want JSON output.

Prompt:

Generate a list of 3 fictional book titles. Return the result as a JSON array of objects with keys: "title", "author", "genre".

Output:
[
  {
    "title": "The Clockwork Cloud",
    "author": "J.D. Gear",
    "genre": "Steampunk"
  },
  ...
]
๐Ÿ”‘ Key Takeaway: Always use delimiters for user input and request JSON output for programmatic use.
๐Ÿงช

Try It Yourself

Practice what you learned with our interactive tools.

โœจ Open Magic Optimizer
๐Ÿ’ก

Pro Tips

  • โ€ข Be specific with your instructions
  • โ€ข Use examples when possible
  • โ€ข Iterate and refine your prompts

Sign in to track your progress

Sign in to Complete