The Drupal AI module provides a framework for easily integrating Artificial Intelligence on any Drupal site using any kind of AI (from multiple vendors). The AI module aims to provide a suite of modules and an API foundation for generating text content, images, content analysis and more.
We're combining the best features and approaches from AI Interpolator, OpenAI, Search API AI and other modules in a unified framework and solution for AI in Drupal no matter what major model or service you choose to use. At its heart is an abstraction layer that enables integrations with third party AI providers such as OpenAI (ChatGPT, DALL-E), Anthropic (Claude), Fireworks, Mistral and more. However through its Olama, LMStudio and Hugginface integrations you can even use opensource models on servers you host and control.
The AI module has a focus on foundational tools so you can use it out of the box or build your own path to bespoke AI integrations.
Site-builders
This is designed specifically for you. It enables you to build powerful applications with no code in simple, intuitive interfaces.
Developers
You will be impressed by the large flexibility and how easy you can integrate AI in your applications (no more juggling OpenAI keys, out of the box support for multiple vendors) without a lot of burden on administrators.
Administrators
It's an easy tool to enable AI powered features in Drupal with a flexible framework for developers to extend on. For AI orchestration it's an incredible tool to chain multiple AI systems for your site builders.
It's like search_api but then for AI!
Submodules
- AI Core:- The AI provider provides access to all the common models and be extendable to any model required. Modules and recipes using this will be able to swap out any model they need.
- AI Explorer:- This is an area in the admin where you can explore text generation capability and ask it (prompt) whatever you like. An ideal place to test your prompts.
- AI Automators:- Use Automators to populate and change any field in Drupal. This quickly becomes the starting point to create complex and meaningful AI applications where prompts can be chained together in as simple or complex a workflow as you need. A huge range of Automators are provided including using AI LLMs, Web scraping , OCR file extraction. This can be extended further with ECA integration.
- AI Search (Experimental):- Search through your content intelligently where the search understands the meaning of your terms with Semantic Search or ask a LLM Chatbot to explore your content, find it or answer questions about it. By integrating embeddings and vector databases into Search API we can reduce hallucinations in your LLMs or provide it access to more of your own data in what is known as “Retrieval Augmented Generation or RAG”. Currently support Milvus and Zilliz And Pinecone.
- AI Assistants API + Chatbot:- A framework for configuring how these chatbots function allowed for advanced forms of AI search. This provides a single place to handle configuration and innovations in how LLMs do search but allows you to swap out the front-end chatbot to whatever you need. We have an example chatbot UI but we plan to support a variable to User interfaces for chat.
- AI CKeditor:- Provides a AI assistant in CKEditor 5 to send a prompt , do spelling corrections, translations and more. All the same features from the OpenAI module, but improved.
- AI content:- Adds assistive tools for different areas of the content editing process. It allows you to adjust the tone of the content, summarise body text, suggest taxonomy terms for nodes, and checks content for Moderation violations.
- AI external moderation - Enables you to use OpenAI moderation tool before calls from any (non OpenAi) LLM provider.
- AI logging:- Enables you to log any AI request and response.
- AI translate:- Provides a simple one-click AI powered translations, ideal for multilingual sites.
- AI validations:- Works with field_validations so you can use AI/LLM prompts to validate text.
Planned Sub-modules
- AI Evaluations
:- A framework for testing and evaluation LLMs and complete AI applications.
AI Providers
In order to power your Drupal with AI, you'll need a AI provider module. Here are some of the frequently used provider modules:
- amazee.io
- Anthropic
- Auphonic
- AWS Bedrock
- Azure
- Deepseek
- Deepgram
- DeepL Translate
- ElevenLabs
- Fireworks AI
- Google Gemini
- Google Vertex
- Groq
- Huggingface
- LiteLLM
- lmstudio
- Mistral
- Ollama
- Openai
- Perplexity
- xAI
AI Vector Database (VDB) Providers
In order to use the AI Search module - a key step in providing more accurate answers e.g. for AI Chatbots, AI Assistants, AI Overviews, and many other features - a vector database is needed. Here are some frequently used VDB Providers:
Other modules/recipes that work with the AI module
- AI Agents agents framework that can be used to manipulate your website.
- AI Agents & Evaluations Recipe provides some of the agents in a Chatbot UI where you can ask them to manipulate the website. Also comes with an evaluations framework so you can rate and export the responses for further optimizations of the prompts.
- ai_image_alt_text provides a button to generate alt text automatically.
- ai_migrate helps using AI while migrating.
- ai_summarize_document provides an AI CKEditor plugin that can summarize PDF documents.
- auto_translation provides automatic translations.
- ai_seo provides SEO analysis directly within the node view.
- ai_image allows for image generation (with DALL-E or stable diffusion or others) in ckeditor and has a version that supports the AI module
- ai_media_image allows for image generation directly into the media library.
- With ECA and Widgets this can be extended further to create complex workflows or helpful AI widgets inside your content.
- ai_tmgmt use the AI module as a translation provider with tmgmt.
- llmstxt provides information to LLM's at inference time.
- aitxt is used to communicate with data-miners.
- ai_webform_guard use ai to protect webform against spam.
Tutorials and screencasts
The latest screencasts from DrupalCon sessions might provide a good introduction to the module. Introductory Video to the AI Module.
We also have a Press Release announcing the module for more information.
We have a detailed blog post on the vision for the module, its features and submodules and our approach to this module.
Requirements
The AI module requires the Key module (where yo'll save your api keys). Some providers or submodules may require different modules.
PHP / Drupal Core requirements should go here.
Examples
Ckeditor assistant
AI powered translation
AI powered validations
AI explorer
Information for developers
We are actively working on this so feel free to suggest improvements.
If you are trying to implement some extension and are stuck, please don't hesitate to ask in the module's issue queue.
Please also ask to add your module to the list of "Other modules" once it's finished, if it is generally useful.
Example LLM call via AI module
// Find the default selected LLM
$sets = \Drupal::service('ai.provider')->getDefaultProviderForOperationType('chat');
$service = \Drupal::service('ai.provider');
$provider = $service->createInstance($sets['provider_id']);
$messages = new ChatInput([
new chatMessage('system', 'You are helpful assistant.'),
new chatMessage('user', $input),
]);
$message = $provider->chat($messages, $sets['model_id'])->getNormalized();
return $message->getText();
Example image generation call via AI module
$config = [
"n" => 1,
"response_format" => "url",
"size" => "1024x1024",
"quality" => "standard",
"style" => "vivid",
];
$tags = ["tag_1", "tag_2"];
try {
$ai_provider->setConfiguration($config);
$input = new TextToImageInput($prompt);
$response = $ai_provider->textToImage($input_prompt, $default_model, $tags);
$url = $this->saveAndGetImageUrl($response);
Some info on what's available in AI with screenshots is here.
Please join the #ai channel in the Drupal Slack: https://www.drupal.org/community/contributor-guide/reference-information...
Logo(s) and icon(s) by Nico Grienauer.