Prompt Engineering
Core techniques/30 min

Examples and Constraints

Use few-shot examples and constraints to make outputs repeatable without overfitting the prompt to one case.

Lesson

Examples teach by demonstration. Constraints define the boundaries. Together, they help the model produce consistent outputs.

The best examples are short, representative, and labelled. They show the pattern without flooding the context.

Objectives

Choose effective examples.
Write constraints that prevent failure.
Avoid contradictory examples.

Practice

Add two examples to a classification prompt.
Write three constraints for tone, length, and forbidden claims.

Next action

Build a few-shot prompt for a content-review task.