RedLectern topic

Prompting and context

Instructions · examples · supplied context · output requirements · iterative improvement.

For: Everyone

After this page you can: Write and test a clear prompt for a bounded task.

Page reviewed

Part of: Artificial Intelligence

About Prompting and context

A prompt is input supplied to a model to guide its response. For a bounded task, state what the model should do, provide any information it needs, and describe the response you can use. For example, ask it to classify a short set of customer comments as “positive,” “neutral,” or “negative,” and specify that it should return one label per comment.

Start with a zero-shot prompt: make the request without worked examples. If the result misses a pattern or format you care about, add a small number of examples that show the expected input and output. Keep supplied documents or facts distinct from your instructions, and tell the model which parts to use. Then inspect the response against your stated requirements and revise one part of the prompt at a time. This makes it easier to see what changed. A prompt can guide a response, but you still need to check whether the result meets your task.

Start here

route

Write your first bounded prompt

Read the short guide, then draft a prompt with a clear task, needed context, and a requested response shape.

Start with: How do I create a good prompt for an AI model?

Learn the foundations

1.Instructions, examples, and response shapeA clear prompt makes the task explicit and says what a usable response should look like.

A clear prompt makes the task explicit and says what a usable response should look like. Start without examples when the task is simple. If the model misses a pattern, include examples that show the desired scope, wording, or format. Keep examples representative of the cases you expect, and check that they do not accidentally suggest a rule you did not intend. A system instruction is a separate application-supplied instruction in some interfaces; how it is represented and prioritized depends on the system. For machine-readable output, state the expected fields and constraints, and use a schema when the application supports it.

Prompt

Input supplied to a model to guide its response.

System instruction

An application-supplied instruction with a designated priority that varies by system.

Few-shot prompting

Providing task examples inside the prompt.

Zero-shot prompting

Requesting a task without supplying worked examples.

Structured output

Output constrained to a specified machine-readable structure.

JSON Schema

A vocabulary describing and validating the structure of JSON data.

Try it

Write a one-sentence request asking a model to sort three book reviews into positive, neutral, or negative, and specify the response format.

A complete prompt names the sorting task, the three allowed labels, and how each review’s result should be returned.

2.Supply and separate relevant contextInclude information the model needs to complete the task, such as definitions, constraints, or a source passage.

Include information the model needs to complete the task, such as definitions, constraints, or a source passage. Make clear which text is the instruction and which text is material to analyze. For longer or mixed inputs, consistent labels or delimiters can make those parts easier to distinguish. Ask the model to base its answer on the supplied material when that is your intent. Provide enough context to define the task, but keep the prompt focused on the information that can affect the requested result. If important information is missing, say what the model should do, such as ask a question or mark the answer unknown.

Try it

Write a prompt to extract a meeting date from a short email. Add a clear marker for the email text and say what to return if no date appears.

The instruction and email are clearly separated, and the prompt specifies a response for the missing-date case.

3.Test the result and revise the promptPrompting is iterative: a first draft gives you something to evaluate, not a reason to assume the task is finished.

Prompting is iterative: a first draft gives you something to evaluate, not a reason to assume the task is finished. Try the prompt on a few representative inputs, including a case that might be ambiguous or unusual. Compare each response with the output requirements you wrote down. When something fails, identify the specific miss and adjust the relevant instruction, context, example, or format requirement. Test again with the same cases so you can tell whether the change helped. For repeated tasks, keep a small set of sample inputs and expected outputs to make later revisions easier to compare.

Try it

Try your review-sorting prompt on two reviews, one clearly positive and one mixed. Name one change you would make if either result breaks your requested labels or format.

A useful revision identifies the observed miss and changes one relevant instruction, example, context detail, or output requirement.

Explore subtopics

Latest

No recent updates are available.

See the sources list

Books

Glossary

6 terms on this page.

Browse the AI glossary

Questions and comments