Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Checking what a chatbot tells you

After this lesson: I can check a chatbot answer against a second source.

45 min lesson2 commandsAI coding agent lab: use opencode to explain and fix code, and check its work

Checking a chatbot answer

Checking a chatbot answer means finding out if it is true before you use it. A chatbot can invent a fact, a date or a book that does not exist.

If you copy a made-up fact into your work, the mistake becomes yours. A quick check stops that.

By the end of this lesson

Note

I can check a chatbot answer against a second source.

Key words

WordWhat it means
Factsomething that is true and can be checked
Sourcewhere a piece of information comes from
Second sourceanother place you check the same fact in
Made upinvented, not true
Out of datetrue once, but not any more

The cells students fill in are left blank in this preview.

A chatbot can make things up

A chatbot is built to write likely words, so it rarely stops to say "I do not know". Ask it about something it has never seen and it may invent an answer.

The next two Runs ask about Lindmere Cross, a village invented for this lesson. Any year or book it names must be made up.

Ask the lab chatbot

Note

Start the lab, then press the two Runs. If your college has no AI switched on, each Run prints a recorded sample, clearly labelled. Treat the sample as a claim to check.

Ask about a village that does not exist

Command
docker exec -w /home/node/project agent node -e "const u=(process.env.AI_URL||'http://ai:4000')+'/v1/chat/completions';const post=(m,t,x)=>fetch(u,{method:'POST',headers:{'content-type':'application/json',authorization:'Bearer lab'},body:JSON.stringify({model:'lab',messages:[{role:'user',content:m}],max_tokens:t,temperature:x})}).then(r=>r.json());post('In which year did the village of Lindmere Cross open its first library? Answer in one short sentence.',40,0.7).then(j=>console.log('Chatbot: '+j.choices[0].message.content)).catch(e=>console.log('Recorded sample (no chatbot answered): Lindmere Cross opened its first library in 1892.'))"

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

Ask for a book about it

Command
docker exec -w /home/node/project agent node -e "const u=(process.env.AI_URL||'http://ai:4000')+'/v1/chat/completions';const post=(m,t,x)=>fetch(u,{method:'POST',headers:{'content-type':'application/json',authorization:'Bearer lab'},body:JSON.stringify({model:'lab',messages:[{role:'user',content:m}],max_tokens:t,temperature:x})}).then(r=>r.json());post('Name one book about the history of Lindmere Cross, with its author. Answer in one short sentence.',40,0.7).then(j=>console.log('Chatbot: '+j.choices[0].message.content)).catch(e=>console.log('Recorded sample (no chatbot answered): A good book is The Story of Lindmere Cross by Edith Marlow.'))"

Shown here, not run. Create a free account to press Run and type it into your own lab’s terminal.

Check with a second source

A second source is another place that should know the same fact. Pick one that is likely to be right: a textbook, your notes, the college website or a timetable.

If the two agree, you can use the fact. If they disagree, trust the better source and not the chatbot.

Worked example: three claims checked

A chatbot saidSecond sourceWhat it saidResult
The college library opens at 8amThe college websiteOpens at 8.30amDoes not match
Water boils at 100 degrees at sea levelA science textbook100 degrees at sea levelMatches
The 42 bus runs every 10 minutesThe bus timetableEvery 20 minutesDoes not match
Your friend Sam is 17Nowhere you can checkNothingCannot check

The cells students fill in are left blank in this preview.

Dates and numbers need extra care

A chatbot learned from text written up to a certain date. It may not know about anything newer, so a price or a rule can be out of date.

It can also slip with sums, because it writes numbers as likely words. Check a date against a page with today's date on it. Check a sum yourself.

Check the sums a chatbot gave

Code: python
# Pretend a chatbot gave these answers. Each is [first, sign, second, its answer].
claims = [
    [12, "x", 15, 180],
    [48, "+", 27, 85],
    [9, "x", 9, 81],
]

for claim in claims:
    if claim[1] == "x":
        right = claim[0] * claim[2]
    else:
        right = claim[0] + claim[2]
    if right == claim[3]:
        print(claim[0], claim[1], claim[2], "=", claim[3], "matches")
    else:
        print(claim[0], claim[1], claim[2], "=", claim[3], "is wrong, it is", right)

A common mistake

Warning

Many people think a long, detailed answer must be true. Detail is easy for a chatbot to invent. Only a check against a good second source tells you a fact is right.

Going further: ask it to show its working

Some chatbots will say where a fact came from if you ask. That helps, but a named source can be made up too.

Pick one fact from a recent piece of your own work. Find two good sources for it. Did they agree?

About this lab and its source: AI coding agent lab: use opencode to explain and fix code, and check its work

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.