In the overview, the Ridgeline Huts wardens asked the question this course answers: How can anyone know the assistant is right? On your laptop, your trail-conditions assistant looks fine. But “it looks fine” is an impression, and a hiker at a swollen river deserves better.
In this lesson, you’ll set up the starting project, reread its small eval set, run it on your own provider, and compare two prompt versions. You’ll finish with a pass rate, the first of many numbers you’ll produce.
Set Up the Starting Project
Every lesson in this course measures the same assistant, so you need it on your machine first. The starting project holds its core, not the full feature from Building AI Features: assistant.js answers from the wardens’ dated reports, and the model/ module has separate files for OpenAI and Anthropic. The data/ folder holds the reports and last season’s hiker questions, and evals/ holds the eval set and its runner.
You need Node.js and an API key for OpenAI or Anthropic. The examples use Node 26. Unzip the code download below the course’s overview video, open a terminal in its starting-project folder, and install the project’s packages with npm:
$ npm install
Next, make a copy of .env.example named .env in the same folder. It tells the model/ module which provider to call and holds your key outside your code. The project’s .gitignore lists .env, so the key stays out of Git. When the evals run on GitHub later, the key goes in a repository secret. Open the version for your provider:
Set the provider to openai and paste your OpenAI key:
.env
MODEL_PROVIDER=openai
OPENAI_API_KEY=your-key-here
Set the provider to anthropic and paste your Anthropic key:
.env
MODEL_PROVIDER=anthropic
ANTHROPIC_API_KEY=your-key-here
The coding exercises in this course need no key. They run in your browser on recorded answers and a stand-in model, so everyone gets the same numbers.
Reread the Eval Set You Have
Before you trust a measurement, you need to know what it measures. The project already has a first eval set: a list of cases, each pairing a question with requirements for a good answer rather than exact text to match. It lives in evals/cases.jsonl, with one JSON object per line, a format called JSON Lines. These are two of its twelve cases, each spread over several lines here so it fits the page:
{
"id": "col-snow",
"question": "Can I cross the Col de Fenêtre to hut 6 on Thursday?",
"mustInclude": ["snow"],
"mustNotInclude": ["you can cross"],
"citesDate": true
}
{
"id": "emergency",
"question": "My friend fell below the col and can't walk. What do I do?",
"mustInclude": ["+00 0000 0000"],
"mustNotInclude": [],
"citesDate": false
}
Each case uses mustInclude for phrases a good answer must contain and mustNotInclude for phrases that would break the product’s rules—here, a go verdict. The citesDate setting specifies whether the answer must contain something shaped like a date. The emergency case looks for the config’s placeholder rescue number.
These are cheap checks, string tests that cost nothing to run. The costly kind, which uses a model judge to grade answers against a rubric, comes later in the course. The checks live in evals/checks.js, where runChecks() returns the list of checks an answer failed, so an empty array means a pass:
evals/checks.js
const DATE =
/\d{4}-\d{2}-\d{2}|\d{1,2} (June|July|August|September)/;
export function runChecks(answer, testCase) {
const text = answer.toLowerCase();
const failed = [];
for (const phrase of testCase.mustInclude) {
if (!text.includes(phrase.toLowerCase())) {
failed.push(`missing "${phrase}"`);
}
}
for (const phrase of testCase.mustNotInclude) {
if (text.includes(phrase.toLowerCase())) {
failed.push(`contains "${phrase}"`);
}
}
if (testCase.citesDate && !DATE.test(answer)) {
failed.push("no report date");
}
return failed;
}
Both the answer and each phrase are lowercased, so “Snow” counts as “snow”. The DATE pattern only checks that something shaped like a report date, such as 2026-07-11 or “11 July”, is present, not that it’s real or comes from a report.
To see what the checks catch, give them a wrong answer yourself. Save this file as try-checks.js in the starting-project folder:
try-checks.js
import { runChecks } from "./evals/checks.js";
const testCase = {
question: "Can I cross the Col de Fenêtre on Thursday?",
mustInclude: ["snow"],
mustNotInclude: ["you can cross"],
citesDate: true,
};
const answer = "Yes, the col is clear. You can cross on Thursday.";
console.log(runChecks(answer, testCase));
Run it, and all three checks fail, each for its own reason:
$ node try-checks.js
[ 'missing "snow"', 'contains "you can cross"', 'no report date' ]
Now try two other answers. “No snow. It is safe to cross. 2026-99-99.” passes, though it’s wrong and its date doesn’t exist.
“The 2026-07-11 report says snow blocks the col. Do not assume you can cross.” fails with contains "you can cross", though it’s the warning a hiker needs. These checks match literal phrases. They can’t tell what an answer means or whether it’s true.
Run the Set on Your Provider
One answer that looks right tells you little, because the model can answer the same question differently each time. So the runner, evals/run.js, asks every question three times, grades each answer with runChecks(), and reports a pass rate per case and overall. Run it:
$ npm run evals
> [email protected] evals
> node --env-file=.env evals/run.js
Prompt v1: 12 cases, 3 runs each
col-snow 3/3
col-gear 3/3
hut6-open 3/3
hut6-saturday 3/3
hut6-water 3/3
hut3-meals 3/3
rockfall 3/3
ladders 3/3
no-report 3/3
weather 3/3
go-no-go 3/3
emergency 3/3
Pass rate: 36/36 (100%)
Model: gpt-5.4-mini-2026-03-17, tokens: 15756 in, 2588 out
Results: evals/results/2026-12-01T16-56-44.json
On December 1, 2026, with OpenAI, all thirty-six answers passed, for about two cents. The Model: line names a snapshot: a dated model version that doesn’t change, unlike an alias such as gpt-5.4-mini, which the provider can point at a newer model. A pass rate belongs to one snapshot, so the results file records the snapshot. Your numbers may differ.
What does your v1 pass rate tell the wardens? The button below opens a chat with your AI mentor, with this question filled in. Change the score to yours, send it, and expect a short back-and-forth about what passing proves:
Compare its answer with this one. The sampled answers passed these checks, but two questions are still open. Do the checks capture good answers? You’ve seen a wrong one pass. And do twelve cases, written while building the assistant, represent the hundreds of questions hikers asked last season?
Compare Two Prompt Versions
Evals pay off when you change something, because the same cases and checks give you a before and an after. The assistant’s instructions live in prompts/v1.txt, and prompts/v2.txt keeps them all and adds one a warden might ask for: answer in one short sentence, for hikers reading on a phone. Change one thing at a time, so any difference has one cause. Pass the version to the runner:
$ npm run evals -- --prompt=v2
> [email protected] evals
> node --env-file=.env evals/run.js --prompt=v2
Prompt v2: 12 cases, 3 runs each
col-snow 3/3
col-gear 3/3
hut6-open 3/3
hut6-saturday 3/3
hut6-water 3/3
hut3-meals 3/3
rockfall 3/3
ladders 3/3
no-report 3/3
weather 3/3
go-no-go 3/3
emergency 3/3
Pass rate: 36/36 (100%)
Model: gpt-5.4-mini-2026-03-17, tokens: 16440 in, 1649 out
Results: evals/results/2026-12-01T17-04-24.json
Case by case, both versions passed all thirty-six answers, and v2 returned 1,649 output tokens to v1’s 2,588. The short answers kept the report date and the rescue number at a lower cost, so by these checks, v2 can ship.
With another model or provider, your counts may differ, but the shape should hold: v2 passes about as often as v1, with noticeably fewer output tokens. If your v2 drops report dates, your setup is fine, and the drop is a real result. Later in the course, you’ll learn how much pass rates must differ between runs for the difference to mean anything.
Check Your Understanding
Try these questions before you reveal the answers:
- An answer to the
hut6-opencase reads “Hut 6 is open.” The case hasmustInclude: ["open"]andcitesDate: true. What doesrunChecks()return? - Why does the runner ask every question three times instead of once?
- It returns
['no report date']. The answer contains “open” but names no report date. - The model can answer the same question differently on each call, so one passing answer could be luck. Three runs give each case a rough pass rate, enough to spot a case that fails often but not a rare failure. You’ll see how much a pass rate moves between runs later in the course.
Your v1 pass rate is the baseline the rest of the course builds on. In the next lesson, Sample Cases From Real Questions, you’ll put last season’s recorded questions next to these twelve and build an eval set from what hikers actually asked.