Skip to content

Tagify AI Suggestions

Tagify AI Suggestions adds a Get AI Suggestions button to the Tagify widget. On click, it sends the content being edited and the field's referenceable entities to an AI provider, and shows the entities that fit as a strip of chips under the widget. The editor clicks the chips that fit, or adds them all at once.

Requirements

  • Tagify.
  • AI with at least one configured provider that implements the decision, text_classification, or chat operation type.
drush en tagify_ai_suggestions

How a request works

sequenceDiagram
    actor Editor
    participant W as Tagify widget
    participant D as Drupal
    participant P as AI provider
    Editor->>W: Click "Get AI Suggestions"
    W->>D: AJAX request with the unsaved form
    D->>D: Check permission and flood limit
    D->>D: Render the entity in the chosen view mode
    D->>D: Collect candidates, narrow to the ceiling
    D->>P: Content + candidate labels
    P-->>D: Scores or chosen IDs
    D-->>W: Suggestions above the minimum score
    Editor->>W: Click the chips that fit

Configuration

Open the Tagify widget settings of an entity reference field, for example under /admin/structure/types/manage/article/form-display, and expand AI suggestions.

Setting Default Description
Enable AI suggestions off Shows the button on this widget.
AI provider and model none The model to call. The list groups models under Decision models, Text classification models, and Chat models. A model offered by several operation types is listed once, under the first group, and that group decides how the widget asks.
Maximum suggestions 3 How many tags one click can offer, between 1 and 20. Always capped at the field's remaining cardinality.
Minimum score 0.5 Score a tag needs to be suggested, between 0 and 1. Shown for decision and text classification models.
Match Explicit Decision models only. Explicit suggests topics the content discusses; Related also suggests closely related topics the content does not name.
Content used for suggestions Default The view mode rendered as the text the model judges. Only view modes with custom display settings for the bundle are listed.

If no provider offers one of the three operation types, the settings are shown disabled.

Tuning tips

  • Minimum score is provider specific. Raise it when unrelated terms get through, lower it when good terms are missed.
  • On a single value field, decision models answer one choice question where all tags share one probability distribution, so similar terms split the score. Start around 0.3 there.
  • Create a dedicated view mode, for example "AI context", to send exactly the fields that describe the content, including paragraphs.
  • Fill in term descriptions. Candidates are sent as Label: description when a description exists, which improves the answers.

Operation types

Operation type How it asks Scores
Decision (decision) One true/false question per candidate, with the content as state. Models that cannot answer several true/false questions in one request get a single choice question over all labels. Single value fields use the choice question when the labels fit, with a "None of these" option. Yes, per tag
Text classification (text_classification) Sends the candidate labels as classification labels. Yes
Chat (chat) Sends candidates inline as id: label pairs and asks for a JSON list of IDs. No, so Minimum score does not apply

Decision is experimental

The Decision operation type requires a version of the AI module that provides it. Until then, no Decision models are listed.

The Decision questions are batched by the model's declared per-request question limit, or 20 when it declares none, with at most 16 requests per click. A model with a low limit therefore supports a smaller vocabulary.

What is and is not suggested

  • Terms already in the widget are not suggested again.
  • Unpublished entities are never suggested.
  • When Parent selection is off, top level terms that have children are not suggested.
  • The button does not appear for fields inside embedded forms such as Paragraphs or Inline Entity Form.

Limits

Each operation type has a ceiling on how many candidates one request carries:

Operation type Ceiling
Decision 255
Text classification 255
Chat 1000

A vocabulary above the ceiling is narrowed on each request to the best matches: entities whose names appear in the content, entities the field already references often, and entities often referenced together with the best matches. No index is needed. The widget settings say when a field is above the ceiling. Entities that match neither the content nor earlier use cannot be suggested.

Term descriptions are sent until they use a 10,000 character budget; the remaining candidates go as bare labels.

Each user can trigger at most 30 provider calls per minute. Requests above that get a warning and never reach the provider.

Permissions

Permission Machine name
Use Tagify AI suggestions use tagify ai suggestions

The button renders only when the widget has AI suggestions enabled, the user has this permission, and the configured provider still resolves. The permission is marked as restricted.

Privacy

Warning

A click renders the unsaved entity in the chosen view mode, without the Tagify field itself, and sends it to the configured AI provider, which may be an external service. Enable the feature only for content that may be sent off site, and grant the permission only to users you trust with that.

Developers

hook_tagify_ai_suggestions_prompt_alter() changes the chat system prompt and the decision question. See Hooks.