The AI Integration module is designed to reduce the manual workload by updating values in specific cases using AI engines. Engines such as ChatGPT, Gemini AI, and Jasper AI are supported.
Basic use case
The basic use case of the module is to create a predefined prompt that can be used multiple times for different products, for example. Everything in the prompt is passed to an AI engine and the answer it gives back is the result of an operation. Depending on the type of use operation, it can be printed only in the frontend or directly in the backend. When creating a prompt, you can use branch functions to enter values from different fields of an entity, or even values from fields of related entities, using {{ }} and the path to the value you are looking for. The final prompt will display the value instead of {{ }} and the branch function. This way you can have different prompts for different records but with the same structure.
Connection
Before creating use cases, the connection to an AI engine must be set up. It is set up in connections.
For one AI engine only one connection can be set.
Base rules
The AI Integration module enables users to send prompts directly to an AI engine. Users can use the values of any field or attribute of a record as text or files to send them as images to an AI engine. This is achieved using Twig guidelines and syntax. The responses provided will be used as data for the field and must be in text format only.
How to send field values to an AI engine
Field values are referenced by using {{ }}
. In the example prompt below, the value of the Name field (with code name
) is represented by the entity.name.
How to send files to an AI engine
Users can use the sharing feature to provide links to the files they want to share with the AI. Here's what it could look like for Gemini AI:
{% set file = (entity.productFiles | find(i => i.isMainImage==true)).file %}
Give me the HTML description format of the following image, give only description: {{ convertFileToBase64(file) }}
Files used in this method should not be big due to AI limitations.
Use cases
AI can update fields in backend and frontend. Let's create prompts for every type.
Updating values in frontend
To create a predefined prompt that can be used multiple times for different records without affecting the database until the user specifically saves the result, you need an Suggest Value by AI
action.
Go to Administration > Actions and create one with the Suggest Value by AI
type. The options are mostly the same as for Suggest Value action.
Each action can only affect one field at a time. If the user needs AI for more fields, simply create new Suggest Value by AI
actions for each field.
Next, select and connect to an AI engine. Select the entity in which you want to use the prompt (Source Entity
) to create an AI-type action. Then choose a usage method to determine how the button will be configured.
For the Record action button
usage, select Display
(as a single button or a dropdown) and check whether you want it to be a mass action. The display options are the same as for the Suggest Value, and the subsequent steps are the same as for the Field Action Button
case.
For the Field action button
usage, select the Display Field
and Field
. For quality of use purposes, we suggest selecting the same field as Display Field and Field.
Preview / Edit prompt before execution
allows users to double-check prompts before sending them to an AI engine.
Now all the user needs to do is create a prompt that leads to the most appropriate response. This is a case of trial and error and is no different from writing a prompt in AI by hand.
After all the preparation, let's use our prompt.
We will go to Brands and update the brand Hella by using Field action button
approach. Go to edit mode or use inline edit - now you will see the Suggest Value by AI button. Name of the button is the name of the action.
As we have selected the Preview / Edit Prompt before running checkbox, we will see a final prompt and can now edit and send it or cancel the action. If the Preview / Edit prompt before running checkbox is not selected, this step is skipped, and the predefined prompt is sent automatically without confirmation.
If an answer is given, it will appear in the field but will not be saved until the user specifically saves the value. The result given by the AI can also be modified by the user.
Updating values in backend
A predefined prompt that can be used multiple times on different records, but does not affect the database until the user actually saves the result, can only be used on one record at a time. If the user wants mass updates using AI, a Set value By AI action must be created. This can only be done in the backend and the changes are always written to the database. Go to Administration/Actions and create one with Set value by AI type.
For Set value By AI functionality to be available, the user needs the Workflows module to be installed.
The basic logic of an action is the same as in the Suggest value By AI, but instead of a trigger method, the user can choose to display an action and if he wants it to be a mass action. The usage of the created action is the same as in the Update type action.
Here you can see an example of such action:
It can be used in the single record, as a mass action, or as a part of a workflow. The options are the same as for Set value action.
For actions that are used as part of a workflow or as part of a mass action with 5 or more records , it is better to leave the Preview/Edit Prompt Before Execution checkbox unchecked so that the user is not forced to confirm multiple prompts that slow down the process.
Using AI for translations
The Translations module uses the AI capabilities of the DeepL translation tool. However, if you only want to use the AI Integration module, you can still translate into different languages. The possibilities for translation are limited only by the capabilities of the AI you are using.
Here you can see an example of how you can use AI Integration module as a translation tool:
This action is configured to translate the value of the Description
field into German and enter the result into the German Description
field. For every new filed and language you will have to set a new action.
As you can see from the above example, the Translations module definitely has advantages:
- Setting up translations in it is faster than using the AI Integration module.
- The Translations module uses dedicated translation tools instead of the general AI tools used by the AI Integration module.
- Translations made using the Translations module can be adjusted using glossaries for known words.
Therefore, we recommend using the Translations module for regular translations.