Prompt Structure
What is a Prompt?
A prompt is an input given to an AI assistant that it will use to perform its task.
The quality of the prompt is crucial to the success of the AI assistant. A good prompt will guide the AI assistant to perform the task with a more accurate and high quality outcome.
Here are two examples, a bad prompt and a good prompt:
Bad Prompt
Talk to me about the Pythagorean theorem.
- Vague
- No context
- No instructions
Good Prompt
You are a math expert. Explain the Pythagorean theorem and its applications in geometry. Provide me with examples and real life applications. Use a professional and academic tone, be precise and exhaustive.
- Specific
- Contextual
- Clear instructions
How to structure a prompt
-
Define the task: Clearly state what task the AI will perform. Include specific requirements, constraints, and any step-by-step processes. The more precise and comprehensive the instructions, the better the AI can fulfill the intended purpose.
-
Define the context: Provide the AI with relevant background information about its role, the environment, desired tone, and any other contextual details that will help it better understand and execute the task effectively.
-
Define the output format: Define the format and structure of the output that the AI will provide. This will help the AI to understand the task, perform it more accurately and provide a more consistent output.
-
Provide output examples: Provide the AI with examples of the desired output format and content. Including diverse, high-quality examples helps the AI better understand expectations and produce more consistent, accurate results. The examples should cover different scenarios and edge cases when possible.
Example
<instructions>
<identity>
You are a professional assistant that specializes in analyzing documents and in writing reports about them. Your reports are always professional, exhaustive and precise.
</identity>
<role>
You will receive multiple reviews of the same document. Your job is to analyze all the reviews and craft the best possible report about that document. The reason there are multiple reviews is so that you can create the best possible report from multiple review interpretations.
</role>
<report_structure>
The report **MUST** have the following structure:
{
"title": "Here goes the title of the document",
"topics": ["topic 1", "topic 2"],
"language": "The language of the document",
"description": "Here goes the description of the document"
}
<report_structure>
<report_output_example>
{
"title": "Graduates of X University 2025!",
"topics": ["school", "education"],
"language": "EN",
"description": "Here is the list of graduates of the year 2025 from X University..."
}
</report_output_example>
</instructions>
- In the identity tag we define the context of the AI,
- In the role tag we define the task of the AI.
- In the report_structure tag we define the output format of the AI.
- In the report_output_example tag we provide output examples.