Nearby lessons

9 of 49

Prompt Engineering - Constraints and Ambiguity

Ambiguity — Why AI Guesses

Ambiguity means an unclear or incomplete instruction. When the prompt is not clear, AI fills the missing gaps by guessing based on probability — and the output becomes random. The problem is not the AI; the problem is the unclear instruction.

In simple words: Ambiguity makes AI guess, clarity makes AI accurate. A prompt should be like a requirement document, not a casual chat message.
Ambiguous PromptClear Prompt
Missing detailsFull details
Multiple meaningsSingle meaning
AI guessesAI understands
Random outputStable output

The friend example explains it:

  • Say "Bring it" to a friend → they guess — wrong item, wrong place.
  • The problem is not the friend, it is the unclear instruction.

AI behaves exactly the same way.

Example01
Prompt PreviewChatGPT-style
AMBIGUOUS: Explain cloud
Cloud is a way to store data on the internet. (random — which cloud? for whom? what about it?)
CLEAR: Explain cloud computing for non-technical people using simple English with one example
Cloud computing = using the internet to store files and run software. Example — Google Drive stores your photos online. (audience + purpose clear — stable output) [same topic — only the prompt changed]
Copy the prompt and paste it into ChatGPT, Gemini, or Claude to try it.

Constraints — Rules That Control AI

Constraints are rules that limit AI behavior. Each type controls one thing:

  • Length constraint — controls size.
  • Tone constraint — controls style.
  • Format constraint — controls structure.
  • Plain rules — control what AI may or may not do.

Without constraints, AI has too much freedom and the output becomes inconsistent.

In simple words: Constraints control AI, examples stabilize AI. Together they give you full control over the response.
Without ConstraintsWith Constraints
Random outputControlled output
InconsistentStable
Hard to reuseEasy to reuse
ConfusingClear
Example02
Prompt PreviewChatGPT-style
WITHOUT CONSTRAINTS: Explain Python loops
A loop is used in Python to repeat a block of code, with for and while loops plus break and continue to control them. (no length, no format — output varies every time)
WITH CONSTRAINTS: Explain Python loops in exactly 5 bullet points using simple English. Do not add explanation
- A loop repeats a block of code - It saves time and typing - It makes the code short and clean - A "for" loop runs a fixed number of times - A "while" loop runs until a condition becomes false (controlled — exactly 5 bullets, nothing extra) [same topic — only the constraints changed]
Copy the prompt and paste it into ChatGPT, Gemini, or Claude to try it.

Examples — A Reference That Stabilizes Output

An example is a sample output that guides AI's style. When you show AI one good example, it follows the same pattern — this is called giving a reference.

The carpenter story shows it:

  • "Make table" → confusion.
  • "Make a study table, 4 feet, brown colour" → correct.
  • Showing a sample image → perfect.
In simple words: Constraints give rules; examples give a visible reference — use both for maximum control. AI mirrors the pattern you show it.
Example03
Prompt PreviewChatGPT-style
Example: - Loop repeats work - Loop saves time - Loop makes code short Now explain Python loops in the same style.
Copy the prompt and paste it into ChatGPT, Gemini, or Claude to try it.

Real-World Use Cases

  • Student — exact notes, quick revision, structured study material.
  • Employee — precise reports and clear task instructions.
  • Developer — controlled, predictable outputs for tools.
  • Business — consistent content and clear requirement communication.
📝 Key Takeaways
  • Ambiguity makes AI guess; clarity makes AI accurate.
  • A prompt should read like a requirement document, not a casual chat message.
  • Constraints are rules that limit AI behavior — length, tone, format, and plain rules.
  • Without constraints, AI has too much freedom and the output becomes inconsistent.
  • An example is a sample output that guides AI's style — a visible reference.
  • Constraints + examples = control + stability.

🧠 Test Your Knowledge

4 Questions
Progress: 0 / 4