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]
"""
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.