# Instruction, context and format

> Turn a one-line request into a prompt with a clear instruction, marked context, a named audience and a stated output format, and see what each part changes.

Page: https://schubergphilis.github.io/ai-training/concepts/prompt-anatomy/
License: CC BY-SA 4.0, https://creativecommons.org/licenses/by-sa/4.0/

In this lesson we start from a one-line request that gets a vague answer.
We rebuild it one part at a time, and after each part you run the result in
your own chat tool and see what changed. By the end you have a four-item
checklist you can apply to any request.

You need a chat assistant, and any product you already have access to
works. Every response shown here is illustrative: the author wrote it to
show the pattern. Your model gives a different text, and the comparison you
care about is between your own rounds.

## The one-line request

Here is the material we work with in every round. It is a fictional email
from a supplier. Read it once now, so you can judge each answer later.

> Subject: Change to your delivery of 14 October
>
> Dear customer,
>
> Thank you for your order 4471. Because of a strike at the port, the
> pallets for this order arrive at our warehouse three days later than
> planned. We now expect to deliver on Friday 17 October between 8:00 and
> 12:00 instead of Tuesday 14 October. The two replacement chairs you asked
> about are on the same pallet. If Friday morning doesn't work for you,
> reply to this email with two other dates this week, and we book the first
> one that has a slot. Please confirm by Thursday whether Friday works, so
> we can release the pallet.
>
> Kind regards,
> Varrowmere Freight

Paste the email into your chat tool, and type one line above it.

#### Prompt (illustrative, not a recorded transcript)

```text
Summarize this.

[the email, pasted in full]
```

#### Response

```text
This email from Varrowmere Freight informs the customer that their order
4471 has been delayed by three days due to a port strike. The delivery has
been rescheduled from Tuesday 14 October to Friday 17 October between 8:00
and 12:00, and includes the two replacement chairs. The customer is asked to
confirm by Thursday whether the new time works, or to propose two
alternative dates.
```

You probably got something like this illustrative answer. It is correct
and it is a paragraph
that restates the email in slightly fewer words. Whoever reads it still
has to work out what changed and what they have to do. That is the
default a model falls back on when the prompt leaves everything unsaid:
the prediction that fits most "summarize this" requests in its training
text. In the lesson on how models work you saw that the model has no
picture of what you want beyond the tokens you gave it, so the answer to a
vague prompt is an average of everyone's answer. Every part we add below
takes one of those guesses away from the model.

## The instruction

The **instruction** is the part of the prompt that says what to do. A
clear one names the task, the input it applies to and the constraints to
respect. "Summarize" names a task and nothing else. What counts as a good
summary here is the changes and the actions, and the model has no way to
know that unless you say it.

Rewrite the line so it says what to keep and what to leave out, then run
it on the same email.

#### Prompt (illustrative, not a recorded transcript)

```text
Summarize the email below. Keep only what changed compared to the original
plan and what we have to do about it. Leave out greetings, apologies and
the reason for the delay. Do not add anything the email doesn't say.

[the email, pasted in full]
```

#### Response

```text
The delivery of order 4471 moves from Tuesday 14 October to Friday 17
October, 8:00 to 12:00. The two replacement chairs are on the same
delivery. You need to confirm by Thursday whether Friday works. If not,
reply with two other dates this week.
```

The greeting and the strike are gone, and the reader gets the change and
the actions. Compare with your first round. Most of the difference comes
from the two constraints, "keep only" and "leave out", and from the one
rule against additions. A model fills any gap with a plausible default,
so most prompt failures trace back to something the instruction left
unsaid (AI Fluency: Framework and foundations, Claude Academy).

## Mark the boundary

The prompt now has two kinds of text. The instruction is yours and tells
the model what to do. The email is the **context**: the material you give
the model to work on. In the prompt they are one stream of tokens, and the
model has to guess where one ends and the other begins. On a polite,
one-topic email the guess is right. When the material itself contains
sentences that look like requests, it often isn't.

#### Pitfall: A line of the email becomes an order

A learner pastes a longer version of the same email and types "summarize"
below it. The email ends with "Please confirm by Thursday whether Friday
works". The model answers: "Confirmed, Friday 17 October works for us."
It has written a reply to the supplier instead of a summary for the
learner. The prompt holds two requests, the supplier's "please confirm"
and the learner's "summarize", and it never says which one is addressed to
the model. Both are plain text in one stream. With a one-word instruction
and a long email, the email's request is the one with more detail behind
it, and the model answered that one. Rule: mark where your instruction ends
and the pasted material begins, so a line of the material can't pass for
the order.

A **delimiter** is a marker that fences off the material. Triple quotes
work, and so does a pair of tags such as `<email>` and `</email>`. Which
marker you pick matters less than using one, and saying in the instruction
which marker you used. The model then has a way to tell the fenced text
(the input) from the text outside it (the instruction) (ChatGPT Prompt Engineering for Developers, DeepLearning.AI). Where
the instruction goes, before or after the material, differs by model and
by how long the material is. For a short paste like this one, either
works.

#### Prompt (illustrative, not a recorded transcript)

```text
Summarize the email between the triple quotes. Keep only what changed
compared to the original plan and what we have to do about it. Leave out
greetings, apologies and the reason for the delay. Do not add anything
the email doesn't say.

"""
[the email, pasted in full]
"""
```

#### Response

```text
The delivery of order 4471 moves from Tuesday 14 October to Friday 17
October, 8:00 to 12:00. The replacement chairs come with it. Confirm by
Thursday whether Friday works, or reply with two other dates this week.
```

On a short, polite email the answer barely changes, as
expected. The boundary costs one line. It pays off when the material is long
or contains requests of its own. It pays off again later, once a tool
rather than you puts the material into the prompt. The safety lessons come back to
this boundary, for the case where the pasted material was written by
someone who wants the model to obey it. A delimiter alone doesn't stop
that, but without one you can't even tell the model which text is input.

#### Checkpoint: Which prompt marks the boundary?

A colleague asks you which of these prompts to use for the supplier
email. Which one marks the boundary between the instruction and the
material?

- The email, pasted in full, and on the next line: "summarize".
- "Summarize the email between the triple quotes for me, in three bullets." Then the email between two lines of """.
- "Summarize this email:" followed directly by the email text, ending with the supplier's request to confirm.
- "Please read the email below carefully and summarize it. Thank you!" followed by the email.

## Audience and purpose

The summary so far is for nobody in particular. In practice a summary is
for someone, who needs it for something, and those two facts decide what
goes in. The same email summarized for the warehouse team lead who plans the
shifts and for a customer who is waiting for the chairs differs in what it
keeps and in how it says it. The model cannot
guess which reader you have in mind, so it picks a general one.

Add one sentence that names the reader and what they do with the text.

#### Prompt (illustrative, not a recorded transcript)

```text
Summarize the email between the triple quotes for the warehouse team lead,
who has not seen it and needs to decide whether to move Tuesday's unloading
shift. Keep only what changed compared to the original plan and what we
have to do about it. Leave out greetings, apologies and the reason for the
delay. Do not add anything the email doesn't say.

"""
[the email, pasted in full]
"""
```

#### Response

```text
Varrowmere moved the delivery of order 4471 from Tuesday 14 October to
Friday 17 October, 8:00 to 12:00, so the Tuesday unloading shift is not
needed for this order. The replacement chairs arrive on the same pallet.
We have to confirm the Friday slot by Thursday. If Friday morning is a
problem, we can reply with two other dates this week instead.
```

The same facts now lead with the one the team lead acts on, the Tuesday
shift, and the confirmation is stated as something "we" have to do. The
prompt didn't ask for either of those. Naming the reader and the purpose
let the model choose them, and it chose better than it did for a general
reader (AI Fluency: Framework and foundations, Claude Academy).

## Format and length

Left to itself, the model usually answers in a paragraph whose length
follows the input, written for a general reader. The next step, a person
scanning a chat message or a program reading the answer, usually wants
something else, and the only way it gets that is if the prompt says so.
State the format and the length, in numbers where you can, and say what
not to put around the answer, such as a heading. "Keep it short" means a different thing to every
reader, and "three bullets, each under 15 words" means one thing.

#### Prompt (illustrative, not a recorded transcript)

```text
Summarize the email between the triple quotes for the warehouse team lead,
who has not seen it and needs to decide whether to move Tuesday's unloading
shift. Keep only what changed compared to the original plan and what we
have to do about it. Leave out greetings, apologies and the reason for the
delay. Do not add anything the email doesn't say.

Format: three bullets, each under 15 words, no heading and no introduction
line.

"""
[the email, pasted in full]
"""
```

#### Response

```text
- Order 4471 delivery moves from Tuesday 14 to Friday 17 October, 8:00 to 12:00.
- Replacement chairs arrive on the same pallet.
- Confirm Friday by Thursday, or reply with two other dates this week.
```

Put the first round next to this one. The email is the same and the model
is the same. The difference is four sentences of prompt, and each one
closed a gap the model would otherwise fill with a default. The next two
lessons add two more parts: one worked example of the output, for when
the format is hard to describe, and a fixed shape a program can read
(AI Prompting for Everyone, DeepLearning.AI).

#### Checkpoint: Which part is this?

Place each fragment of the prompt in the bucket for the part it belongs
to.

Buckets:

- Instruction
- Context
- Audience and purpose
- Format

Items:

- Summarize the email between the triple quotes.
- Do not add anything the email doesn't say.
- Leave out greetings and apologies.
- The pasted email, between two lines of """.
- Our order number is 4471.
- The reader is the warehouse team lead, who hasn't seen the email.
- They need to decide whether to move Tuesday's unloading shift.
- Three bullets, each under 15 words.
- Plain text, no heading, no introduction line.

## Exercise

Pick a short text of your own that you don't mind pasting into a chat
assistant: a notice or a meeting invitation. Send it with a
one-line request first, such as "summarize this" or "what does this
mean". Then rewrite the request with all four parts: an instruction with
its constraints, the text fenced by a delimiter that the instruction
names, one sentence naming the reader and what they do with the result,
and a format with a length in numbers. Send that too, in a fresh chat, and
put the two answers side by side. Ten minutes is enough. Doing this once
on your own text is what makes the checklist stick.

A good result is one where you can point at each sentence of the second
answer and name the part of the prompt that put it there. Which part of
your first request was the model guessing at most?

Stretch: Take the four-part prompt and remove one part at a time, running each version. Which part changes the answer the most for your text?

## Recap

1. A one-line request gets the average answer, because the model fills
   every gap with the most common default from its training text.
2. The instruction says what to do and under which constraints. Most
   prompt failures trace back to something it left unsaid.
3. The context is the material the model works on. Fence it with a
   delimiter, name that delimiter in the instruction, and keep the
   instruction outside the fence. Material and instruction that run
   together let a line of the material become the order.
4. Name the audience and the purpose. They decide what the summary keeps
   and what it leads with.
5. State the format and the length in numbers. "Short" is a guess and
   "three bullets under 15 words" is a check.

## References

- AI Fluency: Framework and foundations, Claude Academy, https://academy.claude.com/courses/ai-fluency-framework-foundations
- ChatGPT Prompt Engineering for Developers, DeepLearning.AI, https://www.deeplearning.ai/courses/chatgpt-prompt-eng
- AI Prompting for Everyone, DeepLearning.AI, https://www.deeplearning.ai/courses/ai-prompting-for-everyone
