How to Write Clear Prompts for AI Models
To write clear prompts, use simple, direct language with specific instructions inside
quotes or brackets. Include context and examples to guide the AI and avoid vague or ambiguous words.Syntax
A clear prompt usually has these parts:
- Instruction: What you want the AI to do, stated simply.
- Context: Background info or details to help the AI understand.
- Example (optional): A sample input/output to show the format or style.
- Constraints (optional): Rules like word limits or style preferences.
Use plain sentences and separate parts clearly.
text
Instruction: "Translate the following sentence to French." Context: "The sentence is about daily activities." Example: "Input: I eat breakfast. Output: Je prends le petit déjeuner." Input: "She goes to school." Output:
Example
This example shows a clear prompt for a text summarization task. It tells the AI exactly what to do and gives a sample.
python
prompt = ''' Instruction: "Summarize the following paragraph in one sentence." Context: "The paragraph is about climate change effects." Example: Input: "Global warming causes ice to melt and sea levels to rise." Output: "Climate change leads to melting ice and rising seas." Input: "Deforestation increases carbon dioxide in the atmosphere." Output:""" print(prompt)
Output
Instruction: "Summarize the following paragraph in one sentence."
Context: "The paragraph is about climate change effects."
Example:
Input: "Global warming causes ice to melt and sea levels to rise."
Output: "Climate change leads to melting ice and rising seas."
Input: "Deforestation increases carbon dioxide in the atmosphere."
Output:"""
Common Pitfalls
Common mistakes when writing prompts include:
- Being too vague or general, which confuses the AI.
- Using complex or ambiguous words that have multiple meanings.
- Not providing enough context or examples.
- Mixing multiple tasks in one prompt.
Clear prompts focus on one task with simple language and clear instructions.
text
Wrong prompt: "Tell me about dogs." Right prompt: "Instruction: List three common dog breeds with a short description for each."
Quick Reference
- Use simple, direct instructions.
- Provide context to guide the AI.
- Include examples to show expected output.
- Keep prompts focused on one task.
- Avoid ambiguous or vague language.
Key Takeaways
Start prompts with clear, simple instructions.
Add context and examples to guide AI responses.
Avoid vague words and multiple tasks in one prompt.
Keep language direct and easy to understand.
Test and refine prompts for best results.