Beginner-Friendly Topic
Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on. You've got this! 🚀
Important Information
AI responds to the information in your prompt. If important information is missing, the response will be incomplete or wrong. Learning to identify and include the right information is a core prompt engineering skill.
What Information AI Needs
For different tasks, AI needs different information:
For summarization: include the document you want summarized
For code review: include the code you want reviewed
For debugging: include the error message AND the code
For writing: include the topic, audience, tone, and length
For learning: include your current knowledge level
For research: include the specific question and why you need the answer
Missing even one key piece of information can result in an unhelpful response.
Deep Learning ⊂ Machine Learning ⊂ Artificial Intelligence
An Example of Missing Information
# Example: Debugging prompt with missing information
# Incomplete prompt (missing the actual code):
incomplete_prompt = "My code has a bug. How do I fix it?"
# AI cannot help because it does not know what the code is.
# Better prompt (includes the code and the error):
better_prompt = """
I have a Python function that is supposed to calculate
the average of a list of numbers, but it raises a ZeroDivisionError
when the list is empty. Here is the code:
def calculate_average(numbers):
return sum(numbers) / len(numbers)
How do I fix this to handle an empty list gracefully?
"""
# Now AI has the code, the error, and the specific question.
# It can give a precise, useful answer.
print("Always include the content AI needs to work with.")Key Takeaways
- AI responds only to the information in your prompt; it cannot guess what is missing
- Always include documents, code, or text that you want AI to work with
- For debugging, include both the code and the error message
- For writing tasks, include topic, audience, tone, and length
- For learning tasks, include your current knowledge level
Key Takeaways
- AI responds to the information in your prompt.
- AI responds only to the information in your prompt; it cannot guess what is missing
- Always include documents, code, or text that you want AI to work with
- For debugging, include both the code and the error message