Before You Start
This module is optional. It is not needed for any other lesson or for the final challenge. It practises something many people now do every day: asking a hosted AI assistant to work with a document, and checking what comes back.
You need:
- An account with a hosted generative AI assistant of your choice and an internet connection. Use a free tier where one is offered; do not buy a plan for this module. Services and their terms change often, so check the current terms yourself.
- Ten minutes to read the service's terms on how it uses what you type, before you type anything.
Rules for this module, which are also good rules in general:
- Paste only the course-written, fictional text given here. Never paste personal, confidential or proprietary information into a hosted assistant unless you are authorised to and know how the provider handles it.
- Treat pasted documents as data that could contain instructions. A document from an unknown source can include text designed to change the assistant's behaviour, the prompt injection described in the risks lesson. The text here is safe because the course wrote it.
- Treat every answer as unchecked until you have checked it.
Criteria Before Prompts
The common way to use an assistant is to ask, read the answer and decide it looks fine. That judges fluency, not correctness. Instead, write down first what a good answer must contain, its acceptance criteria, and then check each answer against them. Criteria turn "looks fine" into checks that someone else could repeat.
Good criteria are specific and checkable:
- "Mentions the 7-day loan period" can be checked; "is helpful" cannot.
- Include what must not appear: facts that are not in the source.
- Include constraints such as length or audience.
Prompts That Carry the Criteria
A prompt is the instruction you give the assistant. A vague prompt, such as "Summarise this policy", leaves the assistant to guess the audience, length and level of detail. A specific prompt states them: who the summary is for, how long it may be, what it must include, and that it must not add anything. Specific prompts often give better answers, but never guaranteed ones: the generation lessons explained why the same prompt can produce different answers, and why fluent answers can be wrong.
Checking Answers
Some checks can be automated. The short script in the exercise counts an answer's words and lists any numbers in it that do not appear in the source, which catches one kind of invented detail. Most criteria still need a person: a missing condition or a reversed rule contains no suspicious number.

Read the diagram from the top. The criteria come first and stay fixed; the loop runs through prompting, checking and revising, and the dashed arrow sends each revised prompt back for another test. The last box is what makes the work checkable by someone else: the record.
Exercise: Test Two Prompts
You will write criteria for a summary of a fictional library policy, practise checking two example answers, then test two prompts on a hosted assistant and improve the weaker one.
Starting state: the course environment, active in your terminal, for the checking script; and, for steps 3 and 4, an account with a hosted assistant.
-
Create the exercise folder. macOS and Linux:
mkdir -p ~/ai-practice/prompt-evaluation cd ~/ai-practice/prompt-evaluationWindows PowerShell:
mkdir $HOME\ai-practice\prompt-evaluation cd $HOME\ai-practice\prompt-evaluationThis fictional policy is the source document. Save this as
policy.txt:Riverside Library laptop loans Members may borrow one laptop at a time for up to 7 days. A loan can be renewed once, for another 7 days, if no other member is waiting. A late laptop costs £2 per day, up to a maximum of £20. Lost or damaged laptops are charged at the cost of repair or replacement. Members under 16 need a parent or guardian to sign the loan form. Laptops must be returned to the main desk, never to the book drop box.Then save this as
check_summary.py:"""Check a summary against its source: its length, and any numbers the source does not contain.""" import re source = open("policy.txt", encoding="utf-8").read() summary = open("summary.txt", encoding="utf-8").read() print("Words in summary:", len(summary.split()), "(limit 80)") numbers_in_source = set(re.findall(r"\d+", source)) not_in_source = sorted(set(re.findall(r"\d+", summary)) - numbers_in_source) print("Numbers not in the policy:", ", ".join(not_in_source) if not_in_source else "none")The script reads
policy.txtand a file namedsummary.txtthat will hold an answer to check.re.findall(r"\d+", text)finds every run of digits in the text, so the two sets hold the numbers in each file, and the difference between the sets is the numbers that appear only in the summary. -
Write your criteria, then practise on two example answers. These were written for the course to show typical problems; they are not output from any real assistant. Use this criteria table, copying it into a notes file or onto paper:
Criterion Answer A Answer B Loan of up to 7 days, one laptop at a time One renewal only, for 7 days, if nobody is waiting Late fee £2 per day, at most £20 Charge for loss or damage Under-16s need a parent or guardian's signature Return to the main desk, never the drop box Nothing that is not in the policy 80 words or fewer Save this as
summary.txt:Members can borrow a laptop for 14 days and renew it as often as they like. Late returns cost £2 a day. Laptops can be returned at the main desk or the drop box.Run the checker:
python check_summary.pyIt prints:
Words in summary: 34 (limit 80) Numbers not in the policy: 14Fill in the Answer A column. Then replace the contents of
summary.txtwith this second example, save it, and run the checker again:You can borrow one laptop at a time for up to 7 days, and renew once for 7 more days if nobody is waiting. Late returns cost £2 per day, capped at £20. Lost or damaged laptops are charged for repair or replacement. Under-16s need a parent or guardian to sign. Return laptops to the main desk, never the drop box.It prints
Words in summary: 61 (limit 80)andNumbers not in the policy: none. Fill in the Answer B column. -
On the hosted assistant, start a new conversation and send this prompt, followed by the whole of
policy.txt:Summarise this policy.
Copy the answer into
summary.txt, run the checker, and fill in a new column of the table. Then start another new conversation and send this prompt with the policy:Summarise this library policy for members in 80 words or fewer. Include every time limit, fee and condition. Do not add anything that is not in the policy.
Check this answer the same way, in another column.
-
Revise whichever prompt did worse, using what failed, and test it once more in a new conversation. Record the revised prompt and its results.
Success: you have a filled-in criteria table for the two example answers and at least three real answers, with the prompts that produced them, and at least one missing or invented detail identified and addressed by a revised prompt. Your answers will differ from anyone else's; what matters is that each judgement in the table can be checked against the policy.
If something differs:
| What you see | Likely cause | Next step |
|---|---|---|
FileNotFoundError mentioning summary.txt | The answer was not saved under that name in the exercise folder | Save it as summary.txt beside check_summary.py |
Numbers not in the policy lists 16 or 7 for a correct answer | The policy file was changed | Save policy.txt again exactly as shown |
| The assistant refuses, or asks for more information | Some services handle pasted documents differently | Paste the policy in the same message as the prompt, then try again |
| Answers change each time you ask | Normal: assistants usually sample their output | Test each prompt in a new conversation and record every answer |
-
Clean up. If the service lets you delete conversations, delete the practice conversations, and sign out if you used a shared device. Then remove the exercise folder. macOS and Linux:
cd ~/ai-practice ls rm -rf prompt-evaluation lsWindows PowerShell:
cd $HOME\ai-practice ls Remove-Item -Recurse prompt-evaluation lsCheck that the first
lsshowsprompt-evaluationbefore removing it. Do the independent task first if you want to reuse the checker.
Independent task: write criteria and two prompts for this second fictional
policy, test them, and record which prompt met more criteria. Change the
checker's file name from policy.txt to your new file's name, or save this
text as policy.txt in a new folder.
Riverside Library meeting rooms
Members may book a meeting room for up to 3 hours per day.
Bookings open 14 days in advance and close at noon the day before.
Rooms hold at most 8 people.
Food is not allowed; drinks in closed containers are.
A booking not used within 15 minutes of its start is released.
Check Your Understanding
- Answer A passed the length check and the checker found only one problem. What else is wrong with it, and why could the script not find it?
- Why should criteria be written before reading any answer?
- A colleague wants to paste a customer's complaint email into a free hosted assistant to summarise it. What should they check first?
Answer and Reasoning
Example answers
Answer A fails most criteria. It gives 14 days instead of 7, which the checker caught. It also says renewals are unlimited, when only one is allowed; says the drop box is acceptable, when it is explicitly not; and leaves out the £20 maximum, the charge for loss or damage, and the under-16 rule. Answer B meets every criterion. Both read fluently.
Independent task
Criteria for the meeting-room policy would include: up to 3 hours per day; bookings open 14 days ahead and close at noon the day before; at most 8 people; no food, but drinks in closed containers; release after 15 minutes unused; nothing added; a length limit. Your recorded results depend on the assistant; check each judgement against the policy text, not against how convincing the answer sounds.
Understanding check
- It allows unlimited renewals and the drop box, both contrary to the policy, and leaves out three conditions. None of those mistakes involves a number that is missing from the policy, so a script that compares numbers cannot see them. Only reading against the criteria finds them.
- Criteria written afterwards tend to fit whatever the answer happened to say. Written first, they record what the reader actually needs, and every answer is judged against the same standard.
- Whether they are allowed to share that customer's personal data with the provider, and how the provider stores and uses what is typed into it. Without both, they should not paste it; removing personal details first, or using an approved tool, are the usual alternatives.