Skip to content

Test a stored AI prompt

Many AI features on a Drupal site send a stored prompt to a model: a prompt with placeholders, such as {inputText}, that the feature fills in. The AI tools in CKEditor work this way. In this tutorial you test the prompt behind Summarize in CKEditor on a set of news articles, then you learn to test a prompt that has more than one placeholder.

It takes about 45 minutes. One run of four questions makes about 12 model calls, so it costs a few cents on a typical provider. You need the test skills from Your first test and Improve your test.

You will learn to

  • test a stored prompt in workflow mode with the AI Prompt engine;
  • choose the model the prompt runs on;
  • fill the other placeholders of a prompt with fixed inputs;
  • read what the run did, step by step;
  • pick the right engine for other AI features on your site.

Terms with a dotted underline are defined in the Glossary. Point at one to see a short definition; click or tap it to read the full entry.

How a question runs through a stored prompt

flowchart LR
    Q["Question<br/>an article"] --> P["Placeholder<br/>{inputText}"]
    F["Fixed inputs<br/>other placeholders"] --> T["Prompt text<br/>filled in"]
    P --> T
    T --> M["Model you choose<br/>in the test"]
    M --> J["Judges and checks<br/>score the reply"]
    J --> S["Score and verdict"]

The question fills one placeholder, the question port. Fixed inputs fill the others, the same for every question. A stored prompt has no model of its own, so the test chooses one.

Before you start

You need:

  • AI Eval's ai_eval_ai_prompt module, and stored prompts in the AI module. The demo site has the default prompts of the AI tools in CKEditor.
  • A chat provider and model in the AI module settings.
  • The Administer AI Eval and Operate AI Eval permissions.
  • Three to five short news articles you may use, in a dataset. If you did Test a FlowDrop workflow, use the same dataset: you can then compare the two features on the same articles. The demo site has this dataset, named demo_summaries.

The screenshots come from the Northmoor demo site, taken as a tester account that has only the permissions above.

Part 1: test the Summarize prompt

1. Choose the prompt

Open Configuration > AI > AI Eval and click Add test.

  1. Label: Tester: Summarize prompt.
  2. Mode: Workflow.
  3. Engine: AI Prompt.
  4. Workflow: AI CKEditor summarize prompt: Default prompt for summarizing CKEditor text. Each stored prompt is one "workflow" for this engine.
  5. Question port: the form picks The input text to summarize (required) (inputText), the only placeholder of this prompt.
  6. Output path: leave it empty. A prompt has one reply.

2. Choose the model

The prompt does not say which model runs it; the feature that uses it does. In Chat Provider, set Provider / Model to the model your feature uses. The demo site uses OpenRouter - Anthropic: Claude Haiku 5.5. Leave System prompt empty unless your feature sends one.

The Workflow settings with the AI Prompt engine, the CKEditor summarize prompt and its inputText port, and Claude Haiku 5.5 in the Chat Provider section

Under the hood: what AI Eval sends

For each question, AI Eval puts the question text into {inputText}, leaves the rest of the stored prompt as it is, and sends the result to the model you chose, with the system prompt, token limit and temperature you set here. It sends the prompt text the site has stored at that moment, so if someone edits the prompt between two runs, the runs test different prompts.

3. Choose the dataset, graders and gate

  1. Dataset: your articles (on the demo site demo_summaries).
  2. Graders: Completeness Grader, Groundedness Grader and Format Grader.
  3. Gate metric: Average score, Gate threshold 4.

Click Save.

4. Run it and read the summary

On the dashboard, open the test's Run page and click Run. Keep the page open until the run is complete, then click View results.

A passing result: 3 of 4 questions met expectations, an average of 4.25, and the model under test ai_prompt / ai_ckeditor_summarize__default

On the demo site the prompt scored an average of 4.25 and passed the gate. Model under test names the engine and the prompt; the model it ran on is listed for each question. One question still failed: Groundedness gave 0 because the summary called a lecturer the "project leader" and said "decades", which the article does not say.

Compare two features on the same articles

If you ran Test a FlowDrop workflow on the same dataset, put the two results side by side. On the demo site the FlowDrop teaser scored 3.83 and this prompt 4.25. With four questions that difference is small; the pass-rate warning on both pages says how wide the range is. Add questions before you decide which feature is better.

5. Look inside the run

Expand a question, then Workflow run.

The Workflow run panel for a prompt: engine ai_prompt, one model call, and two steps, the filled-in prompt and the generate call

A stored prompt has two workflow steps: the prompt with its placeholders filled in, and generate, the model call. Open Output preview on the first step to read the prompt as AI Eval filled it in. A module that listens to AI provider events can still change the text on its way to the model. Previews are shortened to 500 characters.

Part 2: a prompt with more placeholders

The Tone prompt in CKEditor has three placeholders: tone, toneDescription and inputText. Only one of them can take the question. The others get the same value for every question: fixed inputs.

6. Set the question port and the fixed inputs

Start a new test as in step 1, with Workflow AI CKEditor tone prompt.

  1. Question port: the form does not choose one when there are several. Choose The input text to change the tone for (required) (inputText).
  2. Fixed inputs (YAML): one line per other placeholder:

    tone: Friendly
    toneDescription: Warm and plain, for prospective students and their families.
    

The help under the field lists the placeholders the prompt declares. Do not put the question port in the fixed inputs.

The tone prompt with inputText as the question port and tone and toneDescription as fixed inputs

For this test, write criteria about tone in your questions, for example Keeps every fact of the original and reads as friendly and plain., and choose judges that read criteria, such as Completeness and Groundedness. To test another tone, create a second test with the same settings and change only the fixed inputs.

Common mistakes

  • No question port to choose. The prompt has no placeholder in single braces, such as {inputText}. Placeholders in other forms do not count.
  • No model was called. Provider / Model is empty. A stored prompt has no model, and AI Eval does not fall back to a site default.
  • The form refuses the fixed inputs. A name in the YAML is not a placeholder of the prompt, or it is the question port. Compare with the list under the field.
  • Every question is refused. A required placeholder has no value. Give each required placeholder a fixed input, except the question port.
  • Two runs of the same test differ a lot. Someone edited the stored prompt, or the model's temperature is high. Check the prompt text in the first step's preview.
Check yourself: the feature in CKEditor uses a different model from the one in your test. What did your test measure?

The stored prompt on the model you chose, not the feature as editors use it. Set Provider / Model to the model the feature uses, and leave the temperature empty unless you know the feature's setting.

Check yourself: why does the summarize test have no fixed inputs?

The summarize prompt has one placeholder, inputText, and the question fills it. Fixed inputs are only for the other placeholders.

Other engines

AI Eval has runners for other parts of a Drupal site. They all use the same test form: choose Workflow, the engine, its "workflow" and the question port. See Tests for each one.

Engine Its "workflow" is The question goes to
AI Prompt a stored prompt one placeholder, such as inputText
AI Automators an automator on a field of a content type a source field of the content, such as body
Search API a search index keys, the search words; set k as a fixed input
AI Answers an agent enabled for AI Answers question
FlowDrop a FlowDrop workflow an input you declare; see Test a FlowDrop workflow

Next steps

  • Check the judges you used, as in Check a judge against your own labels, before you rely on the gate.
  • Test the same prompt on two models: create a second test with the same settings and change only Provider / Model.