Drupal 11 drupal_rag Module Enables Local Retrieval-Augmented Generation with Ollama

The Drop Times graphic announcing the Drupal 11 drupal_rag module. The image features the drupal_rag logo, a portrait of developer Nino Marrazzo, and text describing local Retrieval-Augmented Generation workflows using Ollama and PostgreSQL with pgvector for semantic search and AI-assisted querying.
Drupal 11 drupal_rag Brings Local RAG Workflows to Drupal

Drupal developer Nino Marrazzo has released drupal_rag, an alpha-stage Drupal 11 module that turns Drupal sites into Retrieval-Augmented Generation (RAG) systems using Ollama for embeddings and PostgreSQL with pgvector for vector storage. The project is intended for organisations that want semantic search and AI-assisted querying capabilities without sending content to third-party AI providers.

According to Marrazzo, the module processes content automatically when Drupal entities are created, updated, or deleted. Text is extracted from supported entities, divided into overlapping chunks, converted into vector embeddings through Ollama, and stored in a pgvector-enabled PostgreSQL database. The project page states that the indexing pipeline operates through entity events, queue processing, text extraction, chunking, embedding generation, and vector storage with HNSW indexing for similarity search.

The module supports Drupal nodes, media entities, and file-based content. Supported file formats include PDF, DOCX, XLSX, PPTX, ODT, ODS, ODP, TXT, CSV, JSON, XML, Markdown, YAML, and log files. Administrators can configure indexed entity types, chunk size, chunk overlap, Ollama endpoints, embedding models, chat models, rendering modes, and prompt templates through a dedicated configuration interface.

Three API endpoints are provided. POST /api/rag/query returns semantically relevant content chunks and similarity scores. POST /api/rag/prompt assembles prompts using retrieved context and configurable templates. POST /api/rag/augment sends prompts to Ollama and returns generated responses together with source metadata and retrieval context.

The project requires Drupal 11, PostgreSQL with the pgvector extension, and an Ollama instance running locally or on the network. A dedicated PostgreSQL connection is used to store embeddings and queue data. The module also provides a Drush command, drupal-rag:queue-all, for bulk indexing of published content.

Marrazzo said the release is being published in alpha form to gather early feedback from developers experimenting with RAG architectures on Drupal. Potential use cases highlighted in the announcement include internal knowledge bases, technical documentation systems, customer support environments, public administration records, and searchable document archives.

Disclosure: This content is produced with the assistance of AI.

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related Drupal Initiatives

Upcoming Events