Skip to content

Measure Ask AI on the AI demo

The AI demo answers visitor questions on its search page with AI Answers, shown as Ask AI. In this tutorial you install a ready test with six story questions, run it as an anonymous visitor, and read which answers fall short and why. You write nothing: the questions and their rubrics come with AI Eval as a recipe.

It takes about 15 minutes.

You will learn to

  • install the example test with one command;
  • run it and read which checks an answer failed;
  • run it more than once and compare two runs;
  • grade stored answers again after you change a rubric.

The six questions

Question The answer passes when it
q1_entry: entry requirements for Marine Resource Management names statistics and says no natural science degree is needed
q2_courses: which courses it includes, as a follow-up to q1_entry names the program's three courses
q3_parking: the price of a visitor parking permit says the site does not give it, and names no price
q4_programs: which programs the university offers names all 11 programs
q5_entry_es: q1_entry asked in Spanish gives the same facts, in Spanish
q6_fisheries: which departments work on fisheries names Life Sciences and Marine Policy and Economics

Every answer except q5_entry_es must be in English. Except for q3_parking, an answer that says it could not find the information fails.

Before you start

  • An AI demo site where Ask AI answers on the search page.
  • AI Eval 1.1.0-alpha8 or later.

Each run asks Ask AI six times

The answers come from the demo's own model, and each one costs what a visitor's question costs. The rubrics call no model.

1. Install the test

In the site's project folder (with DDEV, put ddev in front of each command):

composer require 'drupal/ai_eval:^1.1@beta'
drush recipe modules/contrib/ai_eval/recipes/ai_demo_ask_ai

The recipe turns on AI Eval and its AI Answers module, and adds the test Ask AI story questions, its dataset and six rubrics. There is nothing else to set: the test has no judge.

Under the hood: rubrics without a judge

Each question points to a rubric of text checks: phrases the answer must contain or must not contain, and patterns. A check passes or fails the same way every time, and it calls no model. Each rubric checks that the answer is not a refusal, is in the right language, and has the facts the demo's content holds.

2. Look at the questions

Go to AI Eval > Manage > Datasets and open Ask AI story questions. The six questions are listed in run order. q2_courses says follows q1_entry: it is asked as the next turn of the same conversation, as a visitor's follow-up is. Every question is asked as an anonymous visitor (caller 0), the way most visitors use the search page.

3. Run it

Go to Configuration > AI > AI Eval and click Run next to Ask AI story questions. The progress page shows how far the run is. A run takes a few minutes.

4. Read the result

When the run is complete, open its result. The summary shows how many of the six questions passed. Open a question to read the answer and the rubric's reason, for example:

all_pass: 2/3 checks passed; failed: complete

The name says what went wrong:

  • no_refusal or says_not_found: the answer said it could not find the information, or for q3_parking, did not say it.
  • not_spanish or spanish: the answer is in the wrong language.
  • complete: a fact is missing, for example statistics in the entry requirements.
  • no_price: the parking answer names a price.

A complete failure often starts in search, not in the answer: the page with the fact was not found, or its chunk lost the words that make it findable. The Workflow run panel under the answer shows the steps AI Answers took, including its search, and its model calls.

5. Run it five times

Answers vary from run to run, so one run of six answers says little. Run the test five times for 30 answers. To see what changed between two runs, click Compare with... under a run's summary and pick the other run.

6. Change a check and grade again

If a check is too strict, for example it misses a way of saying "not listed", edit its rubric under AI Eval > Manage > Rubrics. Then open a result and click Re-grade. AI Eval grades the stored answers with the rubrics as they are now and saves a new result. It does not call Ask AI again, so it costs nothing.

Check yourself

A run passes 4 of 6. Is Ask AI right two thirds of the time?

Not yet. Six answers are too few to say. Run it five times and count the passes of all 30.

q1_entry fails complete in every run. Where do you look first?

In the question's Workflow run panel: did the search find the program's entry requirements? If not, the fix is in the search index, not in the prompt.

You change a rubric. Do you need to run the test again to see the new scores?

No. Re-grade grades the stored answers with the changed rubric, with no model calls.

Done when

  • The test Ask AI story questions has five complete runs.
  • You can say how many of the 30 answers passed, and which questions failed most.
  • For one failed answer, you can name the check that failed and why.

Next steps