# How to evaluate a docs assistant against real support tickets

> Turn resolved support tickets into an evaluation set, score each answer on citation, support in the cited page, and match to the human answer, and fail on a drop.

Source: https://voxgig.com/howto/evaluate-a-docs-assistant-against-support-tickets

- Audience: devrel
- Level: advanced
- Languages: python, typescript
- Verified: 2026-11-30
- Published: 2026-11-30

## Short answer

Take resolved support tickets, keep the ones a docs page answered, and store each question with the human answer and that page. Run the assistant over them and score citation correctness, faithfulness to the cited page, and relevance to the human answer. Compare each run with a committed baseline and fail on a drop. Grade a weekly sample by hand, because a judge believes a confident answer drawn from a stale page.

---
## You will need

Node 22 or later, Python 3.12 for the Ragas record, and an export of resolved support tickets with
the docs page that answered each one. Take the last two hundred if you have them: the sample holds
30, small enough to read every row. Verified 2026-11-30 against Node 22.23.5 and Python 3.12.3.
No model runs on this page. The assistant is a deterministic retrieval stand-in, the judge is a
scripted policy, and the 30 tickets and eight docs pages are invented, so every score is the
result of those policies.

## Approaches compared

| Approach | When it fits | What it costs you | When to pick something else |
| --- | --- | --- | --- |
| [LangSmith](https://docs.langchain.com/langsmith/evaluation) | Your assistant already sends traces to LangSmith, and reviewers work in one hosted place | An account and an API key, and tickets and answers on its cloud unless you self-host it | Tickets may not leave your systems and self-hosting is out of reach |
| [LLM judge with human grading](https://arxiv.org/abs/2306.05685) | Faithfulness and relevance need reading, not token overlap | A model call per item, plus a person's hour each week | You need a score that is identical on every run |
| [promptfoo](https://www.promptfoo.dev/docs/configuration/expected-outputs/javascript/) | Assertions in CI, with an exit status a pipeline reads | Another config format, and 575 npm packages installed for one CI job | Your harness already runs in your own test runner |
| [Ragas](https://docs.ragas.io/en/stable/concepts/metrics/available_metrics/) | Standard RAG metrics with names your team recognizes | Its faithfulness and response relevancy need a model, so those scores move with the judge | You cannot send answers to a model provider |

Ragas gives you named metrics quickly, but its faithfulness and relevancy scores need a judge
model, so they depend on which model judges. promptfoo fits CI with an exit status a pipeline
reads, at the price of a config and a heavy install. A person grading twenty items a week is slow,
and the only reader here that catches an answer the judge also believes.[^1]

## Build the set from tickets the docs answered

A ticket closed by a product change or an account action has no answer in the docs. Leave it in
and the best possible score drops below 100% for reasons no assistant can fix:

```bash
node evaluate.mjs set
```

```text output
30 resolved tickets
  answered from the docs   24
  excluded, account        2
  excluded, product-change 4
  ceiling if all 30 counted: 80.0%
```

Tag each ticket with what resolved it when it closes, and the filter is one line. A refund
webhook that shipped after the ticket is a product change, even if a docs page describes it later.

## Score each answer three ways

The judge here is a scripted policy, written down so its scores can be reproduced:

```ts title="evaluate.mjs"
export function judge(ticket, reply, docs) {
  const citation = reply.cited === ticket.docs_page ? 1 : 0
  const page = reply.cited && Object.hasOwn(docs.pageText, reply.cited) ? docs.pageText[reply.cited] : ''
  const source = new Set(tokens(page))
  const said = sentences(reply.text)
  const supported = said.filter((s) => {
    const t = tokens(s)
    return t.length > 0 && t.filter((x) => source.has(x)).length / t.length >= 0.8
  })
  // An empty answer, or one citing no page or a page that does not exist, supports
  // nothing: 0, never 0/0.
  const faithfulness = page && said.length ? supported.length / said.length : 0
  const want = [...new Set(tokens(ticket.human_answer))]
  const got = new Set(tokens(reply.text))
  const relevance = want.length ? want.filter((t) => got.has(t)).length / want.length : 0
  const pass = citation === 1 && faithfulness === 1 && relevance >= 0.5
  return { citation, faithfulness, relevance, pass }
}
```

Citation is exact: the cited page is the page that answered the ticket, or it is not. Faithfulness
counts the answer's sentences whose words come from the cited page. Relevance counts the human
answer's words that the answer repeats. Token overlap cannot read meaning, so a model judge takes
the last two in production. Keep the citation check in code whichever judge you use.

## Compare every run with a baseline

`baseline.json` is committed. A run fails when a mean falls more than 0.02 below it or fewer
tickets pass:

```bash
node evaluate.mjs run
```

```text output
run over 24 tickets
  citation correct   91.7%
  faithfulness       0.917
  answer relevance   0.702
  passed             14/24
  failing tickets: T-1001, T-1002, T-1004, T-1005, T-1010, T-1011, T-1013, T-1018, T-1020, T-1021
result: within 0.02 of baseline, pass
```

## Check it worked

Make the regression on purpose: remove the webhooks page and run again.

```bash
node evaluate.mjs run --without webhooks.md
```

```text output
run over 24 tickets, docs without webhooks.md
  citation correct   79.2%
  faithfulness       0.813
  answer relevance   0.656
  passed             13/24
  regression: citation 0.792 < baseline 0.917
  regression: faithfulness 0.813 < baseline 0.917
  regression: relevance 0.656 < baseline 0.702
  regression: passed 13 < baseline 14
  failing tickets: T-1001, T-1002, T-1004, T-1005, T-1010, T-1011, T-1012, T-1013, T-1018, T-1020, T-1021
result: worse than baseline, fail
```

It exits 1. The tests remove each of the eight pages in turn and expect the same failure, and hold
the baseline to the full corpus:

```bash
node --test evaluate.test.mjs
```

```text output
# tests 11
# suites 0
# pass 11
# fail 0
```

## Run the same set through Ragas and promptfoo

`record.sh` exported the answers and ran Ragas 0.4.4 over them with the metrics that need no
model: `IDBasedContextRecall` and `IDBasedContextPrecision` against the cited page, and
`NonLLMStringSimilarity` against the human answer.

```bash
python3 show_ragas.py
```

```text output
ragas 0.4.4, metrics that need no model, 24 tickets
                                baseline  without webhooks.md
id_based_context_recall         0.917     0.792
id_based_context_precision      0.917     NaN
  NaN for T-1010, T-1011, T-1012
  mean without them 0.905, counting them as misses 0.792
non_llm_string_similarity       0.448     0.435
Faithfulness with no LLM set: AssertionError: LLM is not set
```

ID-based recall matches the harness's citation score in both runs. Precision returns NaN for an
answer that retrieved nothing, which is
[how its source decides](https://github.com/vibrantlabsai/ragas/blob/v0.4.4/src/ragas/metrics/_context_precision.py#L291-L295),
so the regression's mean is NaN. Dropping those rows gives 0.905, only 0.012 under the baseline's
0.917. Counted as misses, they give 0.792, the fall the citation score shows. The baseline, the
control, retrieved a page for every ticket and has no NaN.

The promptfoo config calls the stand-in through a
[custom provider](https://www.promptfoo.dev/docs/providers/custom-api/) and the same judge through
a JavaScript assertion:

```bash
node show_promptfoo.mjs
```

```text output
promptfoo 0.126.0, baseline: 14 passed, 10 failed
  PROMPTFOO_PASS_RATE_THRESHOLD=58, exit status 0
  failing: T-1001, T-1002, T-1004, T-1005, T-1010, T-1011, T-1013, T-1018, T-1020, T-1021
promptfoo 0.126.0, without-webhooks: 13 passed, 11 failed
  PROMPTFOO_PASS_RATE_THRESHOLD=58, exit status 100
  failing: T-1001, T-1002, T-1004, T-1005, T-1010, T-1011, T-1012, T-1013, T-1018, T-1020, T-1021
promptfoo 0.126.0, baseline-no-threshold: 14 passed, 10 failed
  PROMPTFOO_PASS_RATE_THRESHOLD not set, exit status 100
  failing: T-1001, T-1002, T-1004, T-1005, T-1010, T-1011, T-1013, T-1018, T-1020, T-1021
```

By default it exits 100 when any test fails, as its
[command-line reference](https://www.promptfoo.dev/docs/usage/command-line/) states, so the
baseline with no threshold exits 100. `PROMPTFOO_PASS_RATE_THRESHOLD` set a little under the
baseline's 58.3% turns that into a regression gate: the baseline run exits 0 and the run without
the page exits 100.

`record.sh` sets `PROMPTFOO_DISABLE_TELEMETRY=1` and `PROMPTFOO_DISABLE_UPDATE=1`, which the
[telemetry page](https://www.promptfoo.dev/docs/configuration/telemetry/) names, and
`RAGAS_DO_NOT_TRACK=true`, which
[the Ragas analytics module](https://github.com/vibrantlabsai/ragas/blob/v0.4.4/src/ragas/_analytics.py#L41-L49)
reads. With its switch set, promptfoo 0.126.0 still posts one event recording the opt-out, as
[its telemetry source](https://github.com/promptfoo/promptfoo/blob/0.126.0/src/telemetry.ts#L111-L129)
shows. So `record.sh` runs both tools behind a local proxy that refuses every request and logs
it. `records/network.txt` holds one refused request to `r.promptfoo.app` for each promptfoo run,
while the Ragas run sent none.

## When it goes wrong

The judge passes an answer a support engineer would reject. The docs page is out of date, so
the answer is faithful to it and still wrong. The weekly sample catches it:

```bash
node evaluate.mjs sample --week 2026-W48
```

```text output
week 2026-W48: 20 items sampled, 20 graded
  judge and grader agree      15
  judge fails, grader passes  4: T-1001, T-1004, T-1018, T-1020
  judge passes, grader fails  1
    T-1009 What is the rate limit in the sandbox?
      assistant: The sandbox allows 25 requests per second. [rate-limits.md]
      grader: says 25; the sandbox allows 50 and the page is out of date
```

The sample is drawn by hashing the week with each ticket id, so it changes weekly and anyone can
recompute it. The grades in this sample are invented. Fix the page, not the judge.

The score falls after a docs migration that changed no content. The tickets name pages by path,
so a rename breaks every citation. The first test fails when a kept ticket names a page that is
missing.

## When not to do this

Do not read a small set as precise. With 24 tickets, one citation that flips moves its mean by
about 0.04, which the 0.02 tolerance catches. One answer that loses a tenth of its relevance moves
that mean by 0.004 and passes, unless the ticket stops passing.

Do not trust a model judge's faithfulness score without the human sample beside it. Both read
the same stale page, so they agree on the wrong answer.

Skip the harness while the assistant is a prototype nobody depends on. Reading thirty answers by
hand costs less than keeping a baseline current, until the first change that someone has to
defend with a number.

## Related how-tos

- [Host docs question answering on Cloudflare Workers](/howto/host-docs-question-answering-on-cloudflare-workers)

- [Re-index docs on release without serving stale answers](/howto/reindex-docs-on-every-release)

- [Run agent evals in CI without flaky failures](/howto/run-agent-evals-in-ci-without-flakes)

- [Chunk an OpenAPI document for retrieval](/howto/chunk-an-openapi-document-for-retrieval)

## Last verified

Verified 2026-11-30 against Node 22.23.5 and Python 3.12.3. Every output block is what the
command preceding it printed in the page's code directory, from records that `record.sh` wrote
with Ragas 0.4.4 and promptfoo 0.126.0. No model ran, so no LLM metric of Ragas was scored.
LangSmith needs an account and was not run, and its row is read from its evaluation documentation.

[^1]: The paper behind the judge row, [Judging LLM-as-a-Judge](https://arxiv.org/abs/2306.05685),
reports that strong model judges matched human preferences with over 80% agreement, the level at
which the humans agreed with each other. The same abstract lists the judges' position, verbosity
and self-enhancement biases, three ways to prefer an answer for something other than its content.