dotAI Workflows
The dotAI feature adds four Workflow Sub-Actions, or actionlets, to dotCMS. Each is considered separately in its own subsection below.
For all asynchronous functions, it is recommended to save all user-generated content and exit the contentlet editor while the write action occurs in the background; the asynchronous process will save when complete, which can result in the loss of unsaved user-generated content.
AI Auto-Tag Content#
This actionlet will attempt to Auto-tag your contentlet based on its values — automatically addressing itself to a Content Type's Tag field, when present. It takes five parameters:
| Parameter | Description |
|---|---|
| Overwrite tags | Select true or false. If false, it will only write to an empty field. |
| Limit the keywords to pre-existing tags | Select true or false. If false, it will add tags to the dotCMS instance's list of tags. |
| Update content asynchronously | Takes an integer value. If 0, it runs only at the time the actionlet is called; otherwise, after being called, it will update the tags in X seconds. (Please see the note about asynchronous Workflow processes.) |
| AI model | The text model used to generate written responses. |
| AI temperature | Determines randomness of the response. Takes a number between 0.1 and 2.0, with 0 as the most deterministic and 2 as the most random, or creative in associativity. |
AI Content Prompt#
This actionlet will generate text content. You may specify both a prompt, which can itself contain Velocity code referencing content data via the $dotContentMap built-in content object.
If the prompt specifies that the AI should return a JSON object, be sure to specify the keys of the relevant object properties; their associated values will be sent to the corresponding fields by variable name.
| Parameter | Description |
|---|---|
| Results | Specify a field to receive the results of the prompt supplied. If left blank, be sure to indicate in the prompt that the AI should return a JSON object. |
| Overwrite | Select true or false. If false, it will only write to an empty field. |
| Prompt | The prompt that will be sent to the AI. May include references to the content object via $dotContentMap. |
| Update content asynchronously | Takes an integer value. If 0, it runs only at the time the actionlet is called; otherwise, after being called, it will update the tags in X seconds. (Please see the note about asynchronous Workflow processes.) |
| AI model | The text model used to generate written responses. |
| AI temperature | Determines randomness of the response. Takes a number between 0.1 and 2.0, with 0 as the most deterministic and 2 as the most random, or creative in associativity. |
AI Embeddings#
This actionlet gives more precise control over the "embeddings" of content. Embeddings are collections of numerical measurements that signify the relatedness of text strings, which are crucial for a variety of AI operations — in particular, for forming semantic search indexes.
If fields are not specified, dotCMS will attempt to guess which fields should be used for indexing operations through the following guidelines:
| Target | Guideline |
|---|---|
| Contentlet | Index the first Block Editor, WYSIWYG, or TextArea field. |
| Page | Render the Page and use the resultant HTML. |
| File Asset or dotAsset | Index the first binary field. |
The AI Embeddings actionlet has three parameters:
| Parameter | Description |
|---|---|
| List of fields | A comma- or newline-separated list of fields, in the form of {contentType}.{fieldVar} (or simply {contentType}) used to generate embeddings. If blank, dotCMS will attempt to intelligently select which fields are used in indexing operations. |
| Index Name | The name of the index appearing in the dotAI Tool to be acted upon. |
| Delete or Insert | Depending on this selection, this actionlet can either add or remove the relevant embedding from the specified index, allowing a high degree of fine tuning at the Workflow level. |
AI Generate Image#
This actionlet allows generation of images based on a dynamically defined prompt. As with the prompt in AI Content Prompt, the prompt may contain references to content via the $dotContentMap built-in content object.
The actionlet's parameters are as follows:
| Parameter | Description |
|---|---|
| Binary field | Specify to which binary field, by variable, the image should be saved. If left blank, the process will select the first binary field in the contentlet. (Note: Currently, this workflow will not output to image fields; only binary fields can store the generated image.) |
| Overwrite | Select true or false. If false, it will only write to an empty field. |
| Prompt | The prompt that will be sent to the AI. May include references to the content object via $dotContentMap. |
| Update content asynchronously | Takes an integer value. If 0, it runs only at the time the actionlet is called; otherwise, after being called, it will update the tags in X seconds. (Please see the note about asynchronous Workflow processes.) |
AI Image Auto-Tagging and Descriptions#
The Image Auto-Tagging and Descriptions sub-action examines an image and provides metadata corresponding to its content — a prose description for use as alt text, and set of tags.
This actionlet has no parameters, but looks for two pre-defined field variables that determine which fields should receive the tags or description, and which image should be read as the source of those values.
| Field Variable Key | Apply Field Variable to | Value |
|---|---|---|
dotAITagSrc | A Tag field | Variable name of field containing the image |
dotAIDescriptionSrc | A Text field | Variable name of field containing the image |
The pattern is the same for both field variables:
- In the content type editor, select the field that should receive the generated tags or alt text.
- Set a field variable key equal to
dotAITagSrcon a tag field, ordotAIDescriptionSrcon a text field. - Set the corresponding value to the variable name of the field that contains the image — e.g., in a standard dotAsset, the value would be
asset.
In addition to descriptive tags, the tag generation will also include the dot:taggedbydotai tag, which prevents further tag population by this process.
Triggering#
There are two ways to trigger the actionlet:
- Standard workflow approach: Firing a workflow action that includes the AI Auto-Tagging and Descriptions sub-action. This allows the usual range of uses, including firing an action from the content search menu.
- On Publish: Even if the actionlet is not present, the Publish action will still trigger this actionlet if the appropriate field variables are defined within the content type.
The firing behavior can also be inhibited:
- Alt text will not be generated if there is already text in the target field.
- Similarly, tags will not be generated if the tag field contains the
dot:taggedbydotaitag.
Configuration#
The vision model this actionlet uses is configured separately from the default dotAI configuration, via configuration properties.
| Property | Default | Description |
|---|---|---|
AI_VISION_MODEL | gpt-4o | The model to use for AI vision. |
AI_VISION_MAX_TOKENS | 500 | The maximum number of tokens to generate for the alt text. |
AI Translate Content#
The AI Translate Content actionlet can use OpenAI to perform translations. You can add this actionlet to any workflow, though an asynchronous workflow is recommended, as the process can take time to complete.
By default, the actionlet will translate your Text, WYSIWYG, Textarea, and Block Editor fields. The actionlet's parameters allow you to specify which types of fields to include.
The default prompts are intended to prevent OpenAI's response from corrupting any HTML- or JSON-based tags found in WYSIWYG and StoryBlock fields.
The full list of parameters:
| Parameter | Value | Description |
|---|---|---|
| Translation to... | A comma-separated list of locale codes. | Lists all languages to which the content should be translated. |
| Translate Fields by Types | A comma-separated list of field system names. | Lists all field types that should be translated if encountered. |
| Translate Fields by Variables | A comma-separated list of field system variable names. | List all specific fields that should be translated if encountered. |
| Ignore Fields by Variables | A comma-separated list of field system variable names. | List all specific fields that not be translated if encountered (i.e., even if its type appears in Translate Fields by Type). |
| Language Variable Prefix (Glossary) | A key prefix for a set of language variables. | If specified, will take up to 1000 language variables with the specified prefix, and use these as a glossary to assist in translation. A value of * will use all language variables; a blank value will use none. |
These parameters allow specifying field types or individual fields for auto-translation or omission.
You can also indicate language variables, in the final parameter. This effectively serves as a lookup table to assist in translation. This is useful when doing domain-specific translations that expect terms to be translated in an exact or non-standard ways. Specify a language key prefix to use; this will load the language property variables that begin with that string — e.g. translation.context. Only variables whose key starts with that prefix — e.g. translation.context.cms and translation.context.content.management — will be included in the lookup table.
Configuration#
The translation actionlet is configured separately from the default dotAI app configuration. Edit the following via configuration properties.
| Property | Default | Description |
|---|---|---|
AI_TRANSLATION_SYSTEM_PROMPT | See below. | Specifies the system prompt the translation calls will use. |
AI_TRANSLATION_USER_PROMPT | See below. | Specifies the user prompt the translation calls will use. |
AI_TRANSLATION_MODEL_KEY | gpt-4o | Specifies the AI model to be used in translation. |
AI_TRANSLATIONS_MAX_TOKENS | Not set. | Maximum tokens to use per call. A value of 0 is treated the same as an unset value. |
AI_TRANSLATION_TEMPERATURE | 0.1 | Sets the temperature, which controls the creativity and randomness of responses; a lower number is more deterministic and literal. |
AI_TRANSLATION_RESPONSE_FORMAT | json_format | Determines the format of the response. Defaults to JSON. |
When configuring a new system or user prompt, there are some specific values that should be noted and included.
The system prompt has the following default value:
You are a domain specific translation engine that translates content from ${sourceLanguage} to ${targetLanguage}.#if($translationKeys)\n\nThe json object below contains a KEY/VALUEs of important domain specific terms and their translations and whenever the KEYs are found in the source, use these VALUEs as the translation in a way that makes sense:\n\n-----------------\n\n${translationKeys}\n\n-----------------\n\n#end
As you can see, it includes Velocity syntax, indicating variables. These variables refer to values specified in the workflow parameters. When multiple languages are specified, individual translations will occur in sequence, over multiple calls; as such, ${sourceLanguage} and ${targetLanguage} will refer to one language at a time.
The system prompt is where the lookup table is created via the Language Variable Prefix parameter, as indicated by the ${translationKeys} variable.
Similarly, this is the default user prompt:
Translate the values of the following source json object which is in ${sourceLanguage}. Return your answer as a JSON object with the same KEYS as the source JSON below but with the values translated into ${targetLanguage}. Rule 1. If the VALUE in the source json object is html, only translate the text and not the tags and do NOT escape the html tags with back slashes. \n Rule 2. if the VALUE is a nested json object - only translate the nested json keys called \`text\`.\n\nThis is the source JSON object to translate:\n\n-----------------\n\n${sourceJson}\n\n-----------------\n\n
Once again, note the use of variables:
${sourceLanguage}${targetLanguage}${sourceJson}
Be sure to include these if you specify an override prompt.