Skip to content
Tutorials Center
My learning

Topics

Lesson 6 of 38 ยท Prompting Fundamentals

Giving Context and Naming the Audience

Learn how background, purpose and audience change a model's answer, how much context is enough, and how to inject context from data with Python.

A model answers in a vacuum unless you fill it. Context is the background that makes a request answerable: who the users are, what the goal is, what already happened, and which facts to rely on. Audience is who will read the result. Together they decide vocabulary, depth, tone and what to include.

The same task, different audiences

Ask for "an explanation of encryption" and you may get something that fits nobody. Name the reader and the answer changes shape.

TEXT
Explain how encryption works to a nine-year-old, in 4 sentences, using the
idea of a locked diary.

Explain how encryption works to a software engineer who knows what a hash is
but not public-key cryptography. Cover why two keys are needed. 150 words.

Same topic, very different outputs. Neither is "better"; each is right for its reader. Naming the audience is one of the cheapest ways to improve relevance.

What context to include

Ask yourself what a smart new colleague would need to do this task well, with no access to your head. Typical items:

  • Purpose: why the output exists ("this goes on a product page").
  • Audience: who reads it, their knowledge level, their mood.
  • Background facts: product details, policies, definitions, prior decisions.
  • Constraints from the situation: legal wording, brand voice, deadlines.
  • What has been tried: previous drafts and why they failed.

Leave out anything that does not affect the answer. Irrelevant context costs tokens and can distract.

Provide facts instead of trusting memory

If an answer depends on your data (prices, policies, dates), paste it in. Do not expect the model to know your company's refund rules, and do not let it guess. Combined with the instruction "use only the information below", this reduces invented details. The retrieval chapter builds on this idea.

TEXT
Use only the policy below to answer. If the policy does not cover the
question, say "The policy does not cover this."

Policy:
"""
Items can be returned within 30 days if unused. Sale items are final.
"""
Python Inject context from data

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The shape matters more than the shop: instructions, then a labelled block of facts, then the question.

Context has a cost: choose what to include

Context is not free. Each added fact uses tokens, can dilute attention, and can conflict with other facts. A selection step helps. The stand-in below picks the facts that share words with the question, a crude version of what retrieval systems do properly.

Python Select relevant context (keyword stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Real systems use embeddings or search engines instead of word overlap, but the goal is the same: give the model the few facts that matter.

State the purpose, not just the task

Telling the model why helps it make good small decisions you did not think to specify.

TEXT
Weak:   Write a headline for this article.
Better: Write a headline for this article. It will appear in a mobile email
        subject line, so it must be under 50 characters and create curiosity
        without clickbait.

The purpose implies a length limit, a tone, and a style, without listing every rule.

Common context mistakes

  • Assuming shared knowledge. Acronyms, internal product names and "the Q3 plan" mean nothing without a definition.
  • Burying the key fact. Put critical facts near the start or end of a long prompt, labelled clearly.
  • Contradictory context. An old policy and a new one in the same prompt force the model to choose. Remove outdated facts.
  • Pasting everything. Quantity is not quality. Select.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why name the audience in a prompt?

    A nine-year-old and an engineer need very different explanations of the same topic.
  2. 2. A question depends on your company's refund policy. What should you do?

    Models do not know your private data. Supplying it and restricting answers to it reduces invention.
  3. 3. Which is a context mistake?

    Contradictory context forces the model to pick one, which may be the wrong one.
  4. 4. Why state the purpose of the output?

    A purpose such as a mobile email subject line implies length, tone and style.

Summary

  • Context is the background a model needs; audience decides vocabulary, depth and tone.
  • Supply your own facts instead of trusting memory, and tell the model to rely only on them.
  • Include what changes the answer, drop what does not, and remove outdated or conflicting facts.
  • State the purpose so the model can make good small decisions on its own.

Next: Controlling Output Format and Length