AI Ustoz UZ: learn artificial intelligence in Uzbek

Examples and constraints

Week 2, lesson 2 · about 6 min

Showing examples (few-shot) is the fastest way to teach a style: “Here are two good samples; write one more in the same style.”

Constraints steer the answer: length (“no more than 120 words”), tone (“formal”), prohibitions (“do not invent numbers”), behavior under uncertainty (“if you do not know, say so”).

The last constraint reduces hallucination, but does not eliminate it completely.

Remember

  • An example teaches the style.
  • Constraints should be clear and measurable.
  • “If you do not know, say so” is a useful instruction.

Exercise

What is useful to add to a prompt so the model does not give you invented numbers?

Answer and explanation
  1. “Answer faster.”Speed does not make an answer more accurate.
  2. “Give the best answer.”That is not a concrete constraint and will not improve the result.
  3. “Use only the information I gave you; if you do not know a number, say so.” (correct answer)Limiting the source and asking it to admit uncertainty reduces the risk.

Practical task

Add one example and two constraints to your prompt.

  • I added an example
  • I added 2 constraints
  • I compared the result with the previous one

Glossary

Interactive mode: search, progress and Python exercises.