ai_insights
Overview
AI Insights brings analytics and notifications to your Drupal site's AI
assistant conversations. It uses LLM-powered classification to automatically
discover what users are asking about, tracks topic trends over time, and
can alert you when things change.
Built on top of
AI Chatlog and the
AI module ecosystem.
Submodules
AI Insights Topics
Automatically classifies AI conversations into topics using your
configured LLM provider. A configurable "granularity prompt" controls
whether topics are broad categories or fine-grained sub-areas. Topics are
stored as taxonomy terms, created on-the-fly as the classifier discovers
them.
- Topic dashboard — top topics ranked by volume,
trend comparison between date ranges, weekly timeline, and a chat vs
search split view. - Chatlog integration — topics appear as a column
and filter on the conversation list, and in the conversation detail
header. - Admin tools — re-tag conversations after
changing the prompt, merge duplicate topics, delete unwanted topics. - Drush command —
drush ai-topics:tagfor manual or catch-up runs.
AI Insights Alerts
Configurable notification rules that evaluate on cron and send email
alerts when topic activity matches your criteria.
- Topic Alert — notify when specific topics
appear above a threshold. - Volume Spike — notify when a topic trends up
compared to its baseline. - New Topic — instant notification when the
classifier discovers a previously unseen topic. - Digest — periodic summary of all topic
activity.
Each rule supports configurable frequency (hourly, daily, weekly),
recipient lists (email addresses and/or Drupal roles), source filtering
(chat only, search only, or both), and a daily email cap to prevent
flooding. A notification log tracks all sent alerts.
How classification works
- On cron, the TopicTagger finds conversations not yet classified.
- User messages are sent to the LLM with a prompt that includes the
granularity instructions and the list of existing topics (to prefer
reuse). - The LLM returns a JSON array of 1–3 topic names.
- Topics are matched to existing taxonomy terms or created as new
ones. - Mappings are stored in a custom table linking thread IDs to term
IDs.
Requirements
- Drupal 10.3+ or 11
- AI Chatlog
- AI (with a
configured chat provider)
Installation
- Install with Composer or place in
modules/contrib/. - Enable:
drush en ai_insights ai_insights_topics ai_insights_alerts - Configure the granularity prompt and AI provider at
Configuration > System > Topic Intelligence. - Run
drush ai-topics:tagto classify existing
conversations. - View results at Reports > AI Topics.
- Create notification rules at Configuration > System >
Topic Notifications.