β οΈ Important β Proof of Concept (PoC)This repository is an early Proof of Concept and not yet feature-complete. Expect bugs and incomplete functionality. The interactive setup wizard (
ddev drupal-ai setup
) currently creates a configuration file at${DDEV_APPROOT}/.ddev/drupal-ai.setup.yaml
containing your AI provider settings.# Example .ddev/drupal-ai.setup.yaml openai_api_key: "sk-..." openai_model: "gpt-4" openai_base_url: "https://api.openai.com/v1" drupal_ai_provider: "openai" drupal_ai_functionalities: "vector-search"The next step in development is to automatically spin up a local Drupal environment with AI modules configured based on your wizard selections.
π Security Note: The current setup stores API keys in a YAML file that should never be committed to version control. Future development will include secure secret management options like DDEV environment variables, external secret stores, or encrypted configuration.
We're actively seeking reviewers and contributors to help complete this project. Please open issues or pull requests on GitHub if you'd like to help.
This add-on provides an interactive CLI orchestration tool for Drupal AI workflows within your DDEV project. It acts as a meta-tool that streamlines the setup and orchestration of AI capabilities in Drupal development environments.
With this add-on, you can:
- Interactive Setup Wizard: Choose AI provider β select functionality β automatic dependency resolution and installation
- Multiple AI Providers: Support for OpenAI, Anthropic, Ollama, and Google Gemini
- Automated Add-on Management: Automatically install required add-ons (pgvector, unstructured, etc.)
- YAML-driven Configuration: Extensible configuration system for providers and functionalities
- Comprehensive Error Handling: User-friendly error messages and rollback capabilities
- Glue Add-on Pattern: Meta-tool that orchestrates other DDEV add-ons
- Interactive CLI: Guided user experience with provider β functionality β setup flow
- YAML-driven Configuration: Steps and configurations defined in YAML, not hardcoded in Bash
- Dependency Management: Automatically install required add-ons based on selected features
ddev add-on get Drupal-AI/ddev-drupal-ai
ddev restart
After installation, make sure to commit the .ddev
directory to version control.
Run the interactive setup wizard to configure your complete AI stack:
ddev drupal-ai setup
This will guide you through:
- AI Provider Selection (OpenAI, Anthropic, Ollama, etc.)
- Functionality Selection (Vector Search, Content Generation, Q&A, etc.)
- Dependency Analysis (Required add-ons will be identified)
- Automated Installation (Add-ons installed automatically)
- Provider Configuration (API keys, models, endpoints)
$ ddev drupal-ai setup
π€ Drupal AI Setup Wizard
========================
Step 1: Select AI Provider
? Choose your AI provider:
β― OpenAI (GPT-4, GPT-3.5, Embeddings)
Anthropic (Claude 3.5, Claude 3)
Ollama (Local LLM - llama3, mistral, etc.)
Google Gemini (gemini-pro, gemini-vision)
Step 2: Select Functionality
? What AI features do you need: (multiple selection)
β― β Vector Search & Embeddings
β Content Generation
β Image Analysis
β Q&A System
Step 3: Dependencies Analysis
π¦ Required add-ons for your selection:
- pgvector (for vector search) β Will install
? Proceed with installation? (Y/n)
Step 4: Installation
β
Installing pgvector add-on...
β
Configuring OpenAI services...
Step 5: Configuration
? OpenAI API Key: [secure input]
? Default model (gpt-4):
? Enable vector search (Y/n): Y
π Setup Complete!
Next steps:
- Run `ddev restart` to apply changes
- Install Drupal AI modules: `ddev composer require drupal/ai`
- Configure at /admin/config/ai
Command | Description |
---|---|
ddev drupal-ai setup |
Interactive wizard for complete AI stack setup |
ddev drupal-ai list |
Display available providers and installed add-ons |
ddev drupal-ai help |
Show help information |
Add-on | Description | Source |
---|---|---|
pgvector |
PostgreSQL with pgvector extension for vector storage | robertoperuzzo/ddev-pgvector |
unstructured |
Document processing and parsing service | drud/ddev-unstructured |
ollama-service |
Local LLM server for running models like Llama, Mistral | stinis87/ddev-ollama |
redis |
Redis cache for improved AI performance | drud/ddev-redis |
Provider | Models | Capabilities |
---|---|---|
OpenAI | GPT-4, GPT-3.5, DALL-E | Text generation, embeddings, image generation |
Anthropic | Claude 3.5, Claude 3 | Text generation |
Ollama | Llama3, Mistral, etc. | Local text generation, embeddings |
Google Gemini | Gemini Pro, Vision | Text generation, image analysis |
Functionality | Description | Requirements |
---|---|---|
Vector Search & Embeddings | Semantic search using vector databases | pgvector, embeddings capability |
Content Generation | AI-powered content creation | Text generation capability |
Image Analysis | AI-powered image recognition | Image analysis capability |
Q&A System | Intelligent question answering | pgvector, text generation, embeddings |
Code Assistant | AI-powered code generation | Text generation capability |
Document Processing | Extract and process various document formats | unstructured add-on |
Configuration is stored in .ddev/drupal-ai.setup.yaml
. Key variables include:
# Provider Configuration
drupal_ai_provider: "openai"
drupal_ai_functionalities: "vector-search,content-generation"
# OpenAI Configuration
openai_api_key: "sk-..."
openai_model: "gpt-4"
openai_base_url: "https://api.openai.com/v1"
# Database Configuration
postgres_db: "drupal_ai"
postgres_user: "drupal_ai"
postgres_password: "drupal_ai"
All configuration is now handled through the main command interface:
# Configure providers and functionalities
ddev drupal-ai setup
# List available providers and installed components
ddev drupal-ai list
# Get help
ddev drupal-ai help
The main drupal-ai
command includes built-in validation and health checks that run during setup.
After setup, you can manage services:
# View all services
ddev describe
# Check PostgreSQL status
ddev exec -s postgres pg_isready
# Check Ollama models (if installed)
ddev exec -s ollama curl http://localhost:11434/api/tags
# View logs
ddev logs -s postgres
ddev logs -s ollama
After setting up the infrastructure:
# Install core AI module
ddev composer require drupal/ai
# Install additional AI modules based on your setup
ddev composer require drupal/ai_search # For vector search
ddev composer require drupal/ai_content # For content generation
ddev composer require drupal/ai_qa # For Q&A systems
- Navigate to
/admin/config/ai
in your Drupal site - Configure your AI provider with the same settings used in the setup
- Test the connection
- Configure specific AI functionalities as needed
Command not found
# Ensure the add-on is properly installed
ddev add-on get Drupal-AI/ddev-drupal-ai
ddev restart
YAML parsing errors
# Install yq if not available
brew install yq # macOS
# or follow instructions at https://github.com/mikefarah/yq#install
Service connection failures
# Check service status
ddev describe
# Restart services
ddev restart
# Check logs
ddev logs -s <service-name>
API connection issues
# Use the interactive setup to reconfigure
ddev drupal-ai setup
To reset all AI configuration, simply delete the configuration file and run setup again:
rm .ddev/drupal-ai.setup.yaml
ddev drupal-ai setup
You can extend the add-on by creating custom configurations in .ddev/drupal-ai/configs/
. See the existing YAML files for examples.
- Fork the repository
- Create your feature branch
- Add tests for your changes
- Ensure all tests pass:
bats tests/test.bats
- Submit a pull request
Run the test suite:
# Install bats if needed
brew install bats-core bats-assert bats-file bats-support
# Run tests
bats tests/test.bats
# Run with debugging
bats tests/test.bats --show-output-of-passing-tests --verbose-run
Contributed and maintained by @Drupal-AI