Examples show a model what a desired input-to-output transformation looks like. Supply consistent demonstrations, then test a new input. Examples are useful when a written rule alone leaves the output ambiguous.

Demonstrate a small classification task

Suppose we classify workshop messages into booking, equipment or other. The rule is simple: booking covers reserving a place; equipment covers what to bring; use other for messages outside those topics.

OpenAI’s few-shot guidance describes steering a task with input/output demonstrations. These examples are included in the request; they are different from fine-tuning a model.

Classify each message as booking, equipment or other.
booking: reserving a place. equipment: what to bring.
Use other if neither applies. Return one label only.

Example input: How do I reserve a seat?
Example output: booking
Example input: Should I bring my laptop?
Example output: equipment
Example input: I enjoyed the session.
Example output: other

New input: Is a tablet enough, or do I need a laptop?

Example answer

equipment

The new message asks what device to bring. It follows the demonstrated label set without copying the wording of a training example or adding a fabricated equipment policy.

Compare a baseline and a demonstrated prompt

Try the task with just the rule and new input first. Then add the examples and use the same held-out messages. Compare exact label use and whether unrelated messages become other. Record the labels each version actually returns.

Do not keep adding demonstrations when the rule is already clear and the task works. Examples increase the input and can introduce conflicting patterns. If one demonstration labels a laptop question booking, repair that inconsistency before judging the model.

Test boundaries, not only easy cases

  • “Where is the room?” should be other under this three-label rule.
  • “Please book a place for me” concerns booking; the label does not perform a booking.
  • “Do I need to book and bring a laptop?” spans two categories. Decide whether your real task needs multiple labels or a stated tie-break rule.

For practice, add a fourth category and one consistent example, then test a message you did not use as a demonstration. Explain your chosen label from the rule. For a structured record with several fields, continue with the output-format lesson.

Compare the same support-routing brief with and without demonstrations in the prompting vocabulary guide. Both versions use the same output checks.