Knowledgebase

Structured Prompts and Delimiters Print

  • aipromptengineering, security, guide, howto, solution, zillionkinghost, hosting, support
  • 0

Organising a complex prompt.

WHY STRUCTURE HELPS

A long prompt containing instructions, context and material is easier for the model to follow when the parts are clearly separated.

HOW TO SEPARATE THEM

Headings, or markers around each section.

"INSTRUCTIONS: ... CONTEXT: ... DOCUMENT: ... QUESTION: ..."

WHY IT MATTERS

Without separation, the model may treat material as instruction, or instruction as material.

That is also a security consideration when processing untrusted content.

FOR DOCUMENTS

Mark clearly where the document begins and ends.

"Here is the document, between the markers: --- [document] ---"

FOR EXAMPLES

Label them as examples so they are not treated as instructions.

FOR MULTIPLE INPUTS

Label each. "Document A: ... Document B: ..."

Then refer to them by label in your question.

WHAT THIS PREVENTS

Confusion about what is instruction and what is content Instructions embedded in a document being followed

THE PRACTICAL HABIT

For anything longer than a paragraph, use clear sections.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot