Drupal RAG Toolkit 1.0.0-alpha9¶
Summary¶
Alpha9 makes the toolkit a working question-answering search for a real site. It rebuilds indexing around selected sources and parallel workers, adds reranking with a stated purpose, adds a knowledge search page with streamed summaries, and adds evaluation that judges answers. On a 5,000-page public-services site, a search returns its sources in about 2.5 seconds and a generated summary starts appearing about 1.5 seconds after it is requested.
It remains an alpha for evaluation and early pilots, not a production release.
Existing installs must reinstall the module. Alpha9 removes every earlier
update hook. Drupal refuses to update a site whose
drupal_rag_toolkit_search_api schema is older than 10009, which includes
every release up to and including 1.0.0-alpha8. Alpha9 is planned to be the
last release that requires a reinstall; later releases will ship update
hooks.
AI-assisted development. Most of this release's code, tests and documentation were written with Claude Code, an AI coding assistant, under the maintainer's direction.
Highlights¶
Answers¶
- Reranking. A chat model scores each retrieved passage from 0 to 10 for how directly it answers the question, in one request. Passages below the profile's minimum score (default 7) are dropped. With reranking off, retrieval order is kept.
- Purpose. A profile can state its purpose in one line, such as "Answers questions about the services provided by the government of Washington, DC." Reranking uses it to reject passages that are about something else, such as another state's rules.
- Citations. Each source is cited once. Inline citation markers are optional.
- Longer summaries. The default answer instruction asks for one or two short paragraphs instead of a couple of sentences.
Knowledge search page¶
- The page lists the recommended sources once, then the other search results without repeating them.
- It asks whether the visitor wants a generated summary of those sources, with citations. The summary streams in as it is written, then is replaced by the checked, cited version. Profiles with a guardrail set do not stream, so every word is checked before it is shown.
Speed¶
- A query reads only the ledger entries of the sources it serves instead of the whole ledger. On 5,000 nodes this took a search from 15–18 seconds to about 2.5.
- Query embeddings and rerank scores are cached for an hour, so a repeated question makes no embedding or rerank request.
Indexing¶
- Selected-source corpora. A build indexes every selected default
revision, including unpublished and access-restricted content, with local
or hosted embedding providers. Publication and access are checked when
results are served: retrieval rechecks the current source and Drupal
entity and field view access for the requesting account. The
public_onlypolicy is retired. With a hosted provider such as OpenAI, this content is sent to that provider. - Parallel builds with 2, 4, 8, 12 or 16 workers. With OpenAI
text-embedding-3-smalland 12 workers, 500 nodes build in about 2.2 minutes and 5,000 nodes in about 30 minutes, including settling. With the OpenAI adapter, one slice of up to eight chunks is one embedding request and one vector write. Ollama sends one chunk per request. - Parking instead of freezing. An unanswered embedding request parks its
source while the worker continues. Each parked source is retried once
automatically, and an operator can authorize another retry. Three parks in
a row on one worker pause the build, which catches failures such as an
invalid key.
drush drupal-rag-toolkit:reindex-parallel-pausepauses or resumes a build. - Settling handles only what changed. Sources edited during a build are corrected when it settles, without re-reading every node.
- Faster maintenance. Saving a node reads only that source's ledger entry. On 500 nodes one edit settles in about 4.5 seconds instead of 12.7.
Lifecycle¶
- One corpus,
default, and onedefaultprofile on a fresh install. The active index belongs to the corpus, so every profile of that corpus uses it. Profile settings apply at once, without reactivating an index. - Indexes can be retired from the index list, and a retired index's resources (Qdrant collection, Search API index, server and AI Search configuration) can be removed from the same page.
- Lifecycle events announce when an index is built, validated, activated, retired or fails.
- A setup page guides a fresh site through naming its environment, and says what to do for each check that is still blocked.
- A fresh install needs only the embedding provider and model in its local corpus mapping; the vector database, engine and dimensions follow.
- Uninstalling deletes the toolkit's configuration, RAG index servers and records, so a reinstall starts fresh. Qdrant collections are kept and listed.
Evaluation¶
- Runs can judge answers: a judge model rates whether each statement is supported by its passages (faithfulness) and whether the answer addresses the question (relevance). Only the scores are kept.
- A case can list alternative sources, any of which counts as finding the answer.
- Questions that logged warnings are flagged in the run.
On the maintainers' 198-question set for a 5,000-page site, the expected page was found for 97% of questions, judged faithfulness was 1.0 and judged relevance 0.97. The maintainers wrote those questions, so expect different results on your own content.
Other¶
- One Query API: the engine returns the same result objects that consumers receive.
- Code is reorganized by lifecycle stage, and names follow one vocabulary (corpus, RAG index, candidate and active index, ledger, slice, worker).
- Requires
drupal/ai1.4.11, which fixes SA-CONTRIB-2026-266 and later advisories.
Install¶
Replace the patches¶
Alpha8 shipped 14 separate patches. Alpha9 replaces them with one patch per package, five in all, including the OpenAI and Ollama providers. Apply them to clean packages, never on top of the old ones:
- Back up
composer.json,composer.lock,patches.json,patches.lock.jsonandpatches/. - Remove the alpha8 entries (
t099-tot116-) frompatches.json, and their files. Keep any patches of your own. - Copy the five files from the package's
support-assets/patches/intopatches/, and add their entries fromsupport-assets/patches.json. - Run
composer patches-relock.
The composer reinstall below then applies each one to a clean copy.
Reinstall the module¶
Uninstall the previous release before installing alpha9:
If the site has Search API indexes left from earlier candidate builds that
use the toolkit's contextual-chunks strategy, such as rag_public or
rag_public_candidate_v3, delete their configuration after uninstalling and
before installing alpha9. The new release treats such servers as managed and
will not clear them through Search API. Deleting the configuration keeps
their Qdrant collections:
drush php:eval '$f = \Drupal::configFactory();
foreach (array_merge($f->listAll("search_api.index.rag_public"), $f->listAll("search_api.server.rag_public"), $f->listAll("ai_search.index.rag_public")) as $name) {
$f->getEditable($name)->delete();
}'
Replace rag_public with your own prefix.
drush pmu drupal_rag_toolkit_search_api drupal_rag_toolkit -y
composer require 'drupal/drupal_rag_toolkit:^1.0@alpha' 'drupal/ai:1.4.11'
composer reinstall drupal/ai drupal/ai_vdb_provider_qdrant drupal/ai_search \
drupal/ai_provider_openai drupal/ai_provider_ollama
drush en drupal_rag_toolkit_search_api -y
drush cr
composer reinstall re-applies the patches to the reference packages;
composer install re-patches only packages whose version changed.
Earlier releases left their records and RAG index servers behind when uninstalled. Installing alpha9 deletes them, keeps their Qdrant collections, and lists the collection names so you can delete them in Qdrant. Then follow Getting started from step 2 to configure the environment and build, validate and activate a new index.
A site running an unreleased alpha9 build from the development repository
may refuse to uninstall with "Stored or effective executable configuration
changed after preparation" or tracking_unavailable. Delete its RAG Search
API indexes first, then uninstall:
drush config:delete search_api.index.<id> # each rag_i_ index
From alpha9 on, uninstalling deletes the toolkit's data and refuses only while a build worker is running; see Uninstalling.
Limitations¶
Alpha9 does not support documents or external sources, a multilingual retrieval policy, an HTTP API, or keyword retrieval for these indexes. See the support matrix before using it beyond evaluation or an early pilot.