g↗genai/ learner
Prompting and Working with AI / Lesson 02

Providing context and constraints

Give an AI assistant the background facts and limits your task needs, and leave out text that distracts or should stay private.

Concept + interactive labBeginner friendly

Four checks before you paste.

In The context window, you saw that a model draws on what it learned during training, while the text it can read in the current exchange is limited to what fits in the conversation. Once you have a clear task, the next choice is what extra text to include in your prompt—the message you send to the assistant.

Pasting everything you have is a common trap. Instead, check every piece of text through four decision lenses before you paste it—starting with safety first, because one note can fit more than one lens.

1. Check first · Keep out

Sensitive information

Personal, confidential, or secret details that could harm someone or break rules if shared. Keep these out first, even when they relate to your task.

2. Include

Relevant context

Safe background facts about your specific situation that the model does not know and needs for this task.

3. Include

Constraints

Rules that shape the reply—such as length, format, tone, or topics to leave out.

4. Leave out

Distracting text

Unrelated, outdated, or contradictory details that compete for attention and can pull the reply off track.

Our invented running example

Sam runs Cedar Bike Shop and wants an AI assistant to draft a short public Thanksgiving hours and repair drop-off notice for the shop's website. Sam has a folder of shop notes—some helpful, some outdated, and one containing a customer's private contact details.

Supply only the relevant background.

Think of briefing a substitute teacher before class. You hand over today's lesson plan and attendance list, not the entire school year's filing cabinet.

An AI model draws on patterns from training and the text in your current prompt. It does not know your local schedule, cutoff times, or rules unless you supply them as relevant context.

In Sam's shop

Without the shop's dates, the assistant has to guess or insert vague placeholders. Sam supplies two relevant facts: the Thanksgiving 2026 schedule (closed Thu, Nov 26; open Fri, Nov 27, 10:00 a.m.–4:00 p.m.; regular hours Sat, Nov 28) and the Wed, Nov 25 at 5:00 p.m. repair drop-off cutoff for pre-holiday service.

Everyday example: When asking for a weeknight dinner idea, list the ingredients already in your fridge and how much time you have—not your grocery receipts from last month.

Set clear limits to shape the reply.

Think of ordering a small sign from a print shop. You give the size and wording limits up front so you do not get a giant poster with extra slogans you did not want.

Constraints set boundaries on how the assistant writes: length, format, tone, or what to leave out. In real prompts, one phrase can act as both context and a constraint—for example, “for first-time visitors” names the audience and limits jargon.

Clear limits steer the draft strongly, though models can still slip on strict rules like exact word counts. Always read and check the draft before using it.

In Sam's shop

Left unconstrained, the assistant writes a long greeting and invents a promotional phone line. Sam adds two constraints: keep the notice under 60 words with a friendly tone and three day bullets, and do not mention sales, discounts, or phone numbers.

Diagram titled Focused Prompt Inputs: Relevant Context (Nov 26-27 hours, Wed 5 p.m. cutoff) and Constraints (Under 60 words, 3 bullets, no sales) flow left to right into AI Model and produce a Focused Draft labeled Notice using supplied details. Bottom strip reads Facts supply details and Limits guide shape.
Relevant context supplies the facts the model lacks, and constraints guide the shape of the draft. You still review the finished notice before posting it.

Everyday example: When summarizing a long club meeting note, ask for three short bullet points in plain English and tell the assistant to skip side discussions.

Leave out distracting and sensitive text.

Think of photocopying a form. You clear old sticky notes and other people's ID cards off the glass before pressing start.

Distracting text—such as outdated offers or unrelated tasks—competes for space and attention inside the context window and can bleed into the draft. Sensitive information—such as personal phone numbers, home addresses, passwords, or private account digits—stays out first, even if it sits in the same note or relates to your work.

Before sharing any real personal or workplace data, check the tool's terms and your organization's rules. If you only need a template structure, replace private details with neutral placeholders like [Customer Name].

In Sam's shop

Sam leaves out a note about last year's 15% helmet sale and a supplier inner-tube order so they do not sneak into the holiday notice. Sam also keeps customer Priya Nair's phone number, home address, and credit card digits completely out of the prompt.

Diagram titled What to Leave Out: Public Schedule and Limits flows into Your Prompt, while Outdated Sale Notes labeled Distracting and Customer Phone and Address labeled Sensitive are stopped at a red Keep Out barrier. Bottom strip reads Your choice before sending: share only what is safe and needed.
The Keep Out barrier represents your own check before pressing send—not an automatic filter built into the tool.

Everyday example: Before pasting a customer support email thread to draft a polite reply, delete the customer's account number, personal email address, and an unrelated earlier billing question.

Quick questions

  • Can I paste everything and tell the AI to ignore the extra parts? That is still risky: private details are already shared once you send the prompt, and unrelated text can still pull the reply off track.
  • Do word-count limits guarantee an exact word count? No. Constraints guide the reply strongly, but models can still drift over or under a strict count, so check the result.
  • Does removing a name make a prompt anonymous? Not necessarily. An address, rare job title, or combination of details can still identify a person.

Build Sam's prompt from blocks.

Try assembling Sam's prompt one block at a time and watch how the illustrative reply responds.

  1. Start with no blocks selected and notice how the reply guesses the hours and rambles.
  2. Add the four helpful blocks (the schedule, drop-off cutoff, length/format limit, and do-not-add boundary) to build a focused prompt.
  3. Turn on the old sale note and the customer contact note one at a time to see what goes wrong, then remove them or press Reset blocks.

Simulation note: The replies and warnings below are pre-written, simplified illustrations of common model behaviors, not a live AI model. Real models vary in how closely they follow limits or react to extra text.

Select blocks to add to Sam's prompt
Base task (always included)Write a public Thanksgiving hours and repair drop-off notice for Cedar Bike Shop's website.

Assembled prompt

  • Task: Write a public Thanksgiving hours and repair drop-off notice for Cedar Bike Shop's website.

Illustrative reply

Dear valued Cedar Bike Shop community, as the autumn season brings us together for Thanksgiving, we want to share a quick update about our holiday schedule and workshop plans so you can plan every ride smoothly. We expect to be closed on Thanksgiving Day and may operate with reduced hours over the holiday weekend—check the door for exact times. Our repair bench fills up quickly around holidays, so stop by earlier in the week if you need tune-up work. Call us at (555) 010-0000 to ask about holiday specials!
0 of 4 helpful blocks included. Still missing: holiday hours, drop-off cutoff, length/format limit, do-not-add boundary.
✎ Try it yourselfKnowledge check · Practice only

Check your understanding.

You want an AI assistant to draft a 3-sentence public FAQ answer explaining your library's late-fee policy. You have four notes: (A) the current 2026 late-fee rules, (B) a rule to keep the reply under 50 words in plain language, (C) a patron's overdue notice with their home address and phone number, and (D) minutes from last year's roof-repair meeting. Which notes should you put in the prompt?
THE TAKEAWAY

Take this with you.

A strong prompt is selective, not exhaustive: supply the relevant background facts and clear constraints your task needs, leave out distracting and sensitive text before sending, and review the draft.