Skip to content

Commit

Permalink
IBX-8689: AI Actions documentation (#2473)
Browse files Browse the repository at this point in the history
* IBX-8689: AI Actions documentation

* Change wording

* PG update

* Implement changes after the release

---------

Co-authored-by: Marek Nocoń <mnocon@users.noreply.github.com>
Co-authored-by: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
  • Loading branch information
3 people committed Nov 18, 2024
1 parent 97a44ea commit 8c90153
Show file tree
Hide file tree
Showing 15 changed files with 346 additions and 2 deletions.
43 changes: 43 additions & 0 deletions code_samples/ai_actions/config/mysql/add_ai_actions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
CREATE TABLE ibexa_action_configuration
(
id INT auto_increment PRIMARY KEY,
identifier VARCHAR(64) NOT NULL,
type VARCHAR(32) NOT NULL,
enabled TINYINT(1) NOT NULL,
action_type_options JSON NULL,
action_handler_options JSON NULL,
action_handler_identifier VARCHAR(64) NULL,
created_at DATETIME NULL COMMENT '(DC2Type:datetime_immutable)',
updated_at DATETIME NULL COMMENT '(DC2Type:datetime_immutable)',
CONSTRAINT ibexa_action_configuration_identifier_uc
UNIQUE (identifier)
) COLLATE = utf8mb4_unicode_520_ci;

CREATE INDEX ibexa_action_configuration_enabled_idx
ON ibexa_action_configuration (enabled);

CREATE INDEX ibexa_action_configuration_identifier_idx
ON ibexa_action_configuration (identifier);

CREATE TABLE ibexa_action_configuration_ml
(
id INT auto_increment PRIMARY KEY,
action_configuration_id INT NOT NULL,
language_id BIGINT NOT NULL,
name VARCHAR(190) NOT NULL,
description LONGTEXT NULL,
CONSTRAINT ibexa_action_configuration_ml_uidx
UNIQUE (action_configuration_id, language_id),
CONSTRAINT ibexa_action_configuration_ml_to_action_configuration_fk
FOREIGN KEY (action_configuration_id) REFERENCES ibexa_action_configuration (id)
ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT ibexa_action_configuration_ml_to_language_fk
FOREIGN KEY (language_id) REFERENCES ezcontent_language (id)
ON UPDATE CASCADE ON DELETE CASCADE
) COLLATE = utf8mb4_unicode_520_ci;

CREATE INDEX ibexa_action_configuration_ml_action_configuration_idx
ON ibexa_action_configuration_ml (action_configuration_id);

CREATE INDEX ibexa_action_configuration_ml_language_idx
ON ibexa_action_configuration_ml (language_id);
13 changes: 13 additions & 0 deletions code_samples/ai_actions/config/postgresql/add_ai_actions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE TABLE ibexa_action_configuration (id SERIAL NOT NULL, identifier VARCHAR(64) NOT NULL, type VARCHAR(32) NOT NULL, enabled BOOLEAN NOT NULL, action_type_options JSON DEFAULT NULL, action_handler_options JSON DEFAULT NULL, action_handler_identifier VARCHAR(64) DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id));
CREATE INDEX ibexa_action_configuration_identifier_idx ON ibexa_action_configuration (identifier);
CREATE INDEX ibexa_action_configuration_enabled_idx ON ibexa_action_configuration (enabled);
CREATE UNIQUE INDEX ibexa_action_configuration_identifier_uc ON ibexa_action_configuration (identifier);
COMMENT ON COLUMN ibexa_action_configuration.created_at IS '(DC2Type:datetime_immutable)';
COMMENT ON COLUMN ibexa_action_configuration.updated_at IS '(DC2Type:datetime_immutable)';
CREATE TABLE ibexa_action_configuration_ml (id SERIAL NOT NULL, action_configuration_id INT NOT NULL, language_id BIGINT NOT NULL, name VARCHAR(190) NOT NULL, description TEXT DEFAULT NULL, PRIMARY KEY(id));
CREATE INDEX ibexa_action_configuration_ml_name_idx ON ibexa_action_configuration_ml (name);
CREATE INDEX ibexa_action_configuration_ml_language_idx ON ibexa_action_configuration_ml (language_id);
CREATE INDEX ibexa_action_configuration_ml_action_configuration_idx ON ibexa_action_configuration_ml (action_configuration_id);
CREATE UNIQUE INDEX ibexa_action_configuration_ml_uidx ON ibexa_action_configuration_ml (action_configuration_id, language_id);
ALTER TABLE ibexa_action_configuration_ml ADD CONSTRAINT ibexa_action_configuration_ml_to_language_fk FOREIGN KEY (language_id) REFERENCES ezcontent_language (id) ON UPDATE CASCADE ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE;
ALTER TABLE ibexa_action_configuration_ml ADD CONSTRAINT ibexa_action_configuration_ml_to_action_configuration_fk FOREIGN KEY (action_configuration_id) REFERENCES ibexa_action_configuration (id) ON UPDATE CASCADE ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE;
18 changes: 18 additions & 0 deletions docs/ai_actions/ai_actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
description: AI Actions help editors by automating repetitive tasks.
page_type: landing_page
month_change: true
---

# AI Actions

The AI Actions LTS update enhances the usability and flexibility of [[= product_name =]] by automating various tasks.
After you configure it, it can generate alt text for images or transform text passages.

You can also extend it to perform other tasks or support additional AI services.

[[= cards([
"ai_actions/ai_actions_guide",
"ai_actions/install_ai_actions",
"ai_actions/extend_ai_actions"
], columns=4) =]]
150 changes: 150 additions & 0 deletions docs/ai_actions/ai_actions_guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
---
description: AI Actions LTS update helps editors by automating repetitive tasks.
month_change: true
---

# AI Actions product guide

## What are AI Actions

Wherever you look, artificial intelligence becomes more and more important by enhancing user interaction and automating complex processes.
[[= product_name =]] can be equipped with the AI Actions [LTS update](ibexa_dxp_v4.6.md#lts-updates), which harnesses AI's potential to automate time-consuming editorial tasks.
AI Actions is an extensible solution for integrating features provided by AI services into your workflows, all managed through a user-friendly interface.

Out-of-the-box, AI Actions solution includes two essential components: a framework package and an OpenAI connector package.
It comes pre-configured with the following action types:

- [Refine text](#refining-text): Rewrite existing text according to instructions set in a prompt
- [Generate alternative text](#generating-alternative-text): Generate alt text for images for accessibility purposes

![AI Actions schematic](img/guide_ai_actions.png)

You can extend the solution's capabilities beyond the default setup by creating custom connector modules, allowing users to take advantage of additional AI services, or customize the way data is processed and interpreted.
For example, it could transform images, or generate illustrations for your articles based on their contents.
The possibilities are endless and you're not limited to a specific AI service, avoiding vendor lock-in.

## Availability

AI Actions are an opt-in capability available as an [LTS update](ibexa_dxp_v4.6.md#lts-updates) to the v4.6.x version of [[= product_name =]], regardless of its edition.
To begin using AI Actions, you must first [install the required packages and perform initial configuration](install_ai_actions.md).

!!! note "API Key"

The OpenAI connector requires that you first [get an API key](https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key) and make sure that you [set up a billing method](https://help.openai.com/en/articles/9038407-how-can-i-set-up-billing-for-my-account).

## How it works

AI Actions LTS update relies on an extensible AI framework, which is responsible for gathering information from various sources, such as AI action types, AI action configurations, and contextual details like SiteAccess, user details, locale settings, and more.
This data can then be combined with user input.
It's then passed to a service connector, such as the default OpenAI connector, for final processing on [[= product_name =]] side.
The service connector wraps all data into a prompt or another suitable format and sends it to an external AI service.

When the AI Service returns a response, the response goes back through the service connector and passes to the framework.
It can then be presented to the user in any way necessary.

### Core concepts

#### AI service

AI service is a third party platform that provides access to artificial intelligence tools and capabilities.
It executes tasks that it receives through a service connector.

#### Action

Actions are tasks or functions that are executed by an external AI service.
Each action is a combination of an AI action type and an AI action configuration.
Action types define what kind of task the AI service performs, while AI action configurations specify how the task should be executed.
This clear separation allows for a flexible system where actions can be created, managed, and customized with minimal effort.

#### AI action type

AI action types are high level templates predefined by developers.
AI action types correspond to tasks that users intend to perform when they interact with the interface. Each AI action type defines the structure and nature of the task that the AI service performs, and is interpreted by a handler.

Action type definitions specify the following information:

- an identifier
- a set of input parameters
- a set of output fields
- a category of action, for example, "text to image", "video to text"

AI action types could be designed, for example, to generate alternative text based on an image, translate a selected passage of text, or generate a video clip based on a description provided in the field.
By defining AI action types, developers can create a wide range of functionalities that can be deployed within the application.

#### AI action configuration

AI action configurations store detailed parameters needed to generate AI actions based on AI action types.
Website administrators manage AI action configurations in the [**Admin** panel](admin_panel.md), where they customize and fine-tune the behavior of each AI action.
It might involve setting specific parameters used by the AI service, a response length, an expense limit, or configuring how the output should be handled.
By making such adjustments, administrators can ensure that the actions are tailored to meet the needs of your organization.

#### Model

Once an AI action is defined and configured, it must be executed, and this is where models come into play.
Each model is designed to work with a specific AI service and AI action type pair.
Pieces of PHP code that are responsible for resolving a model are called handlers.
They may include hardcoded prompts for conversational AI services like ChatGPT, or operate without prompts in the case of other types of AI.
Handlers take parameters defined in the AI action type and configuration, combine it with user input and any predefined settings or prompts, and pass this information to the AI service for processing.

### Triggering actions from the UI

Among other elements, AI Actions LTS update includes UI components that are used in:

- AI action management in the **Admin** panel
- text modification in online editor
- alt-text generation in the image management modal

These areas are user-friendly and well integrated with the existing application’s UI.
Administrators can manage action configurations with ease, while editors can trigger actions with a click of a button.
Procedures are straightforward and intuitive, ensuring that users can quickly achieve their desired outcomes.

### Triggering actions programmatically

AI Actions LTS update exposes a REST API interface that allows for programmatic execution of AI actions.
With the API, developers can automate tasks and execute actions on batches of content by integrating them into workflows.
<!---By issuing commands through the API, developers can trigger actions based on external events:
...--->

## Capabilities

### Management

Users with the appropriate permissions, governed by role-based [policies](policies.md#ai-actions), can control the lifecycle of AI actions by creating, editing, executing, and deleting them.
Additionally, AI action configurations can be enabled or disabled depending on the organization's needs.

![Configurations management screen](img/ai_actions_list.png)

An intuitive AI Actions interface within the **Admin** panel displays a list of all available AI actions.
Here, you can search for specific actions and filter them by type or status.
By accessing the detailed view of individual AI actions, you can quickly review all their parameters.

### Extensibility

Built-in AI action types offer a good starting point, but the real power of the AI Actions LTS update lies in extensibility.
Extending AI Actions opens up new possibilities for content management and editing.
Developers can define new models and AI action types that use the existing AI service or even integrate additional services.
The latter involves developing a new service connector, writing a handler that communicates with the new service, defining a new AI action type, and creating a form for configuring options, which extends the default action configuration form shown in the **Admin** panel.
For example, if this is your organization's requirement, a developer could write a handler that uses an AI service available internally, without exposing your data to a third-party service.

## Use cases

Out of the box, after you configure access to the OpenAI service, the [[= product_name_base =]] AI Actions LTS update comes with two action types that can help your organization with the following tasks.

### Refining text

Content editors can benefit from using AI capabilities to [enhance or modify text]([[= user_doc =]]/content_management/create_edit_content_items/#ai-assistant).
With a few clicks, they can improve content quality or reduce the workload.
While working on content, editors can select a specific passage and request that AI performs specific actions such as: adjusting the length of the text, changing the tone, or correcting linguistic errors.

![AI Assistant](img/ai_assistant.png)

This functionality is available in content types that include a RichText field, and certain Page Builder blocks.

### Generating alternative text

Media managers and content editors can benefit from employing AI to [generate alt text for images]([[= user_doc =]]/image_management/upload_images/#ai), which results in improved accessibility and SEO.
Once the feature is configured, editors can generate alt text for images they upload to the system by clicking one button.

![Alt text generation](img/alt_text_use_ai.png)

With some customization, administrators could use the API to run a batch process against a larger collection of illustrations.
12 changes: 12 additions & 0 deletions docs/ai_actions/extend_ai_actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
description: Extend AI Actions by connecting to other services and adding new capabilities.
month_change: true
---

# Extend AI Actions

By extending AI Actions you can enhance the attractiveness of mundane content management and editing tasks and make them less burdensome.
You can start from adding new action types that use the existing AI service, and evolve to integrating additional ones with completely new areas of application.
For example, you could write a handler that connects to a translation model and use it to translate your website on-the-fly, or generate illustrations based on a body of an article.

## ...
Binary file added docs/ai_actions/img/ai_actions_list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/ai_actions/img/ai_assistant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/ai_actions/img/alt_text_use_ai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/ai_actions/img/diagram_source/AI Actions.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="Electron" modified="2024-10-23T18:29:03.021Z" agent="5.0 (Macintosh; Intel Mac OS X 14_7_0) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/14.6.13 Chrome/89.0.4389.128 Electron/12.0.7 Safari/537.36" etag="6gPmGrvR6C0PY14pvC51" version="14.6.13" type="device"><diagram id="kEppTf-Kki688EfmVOyB" name="Page-1">7VvZlqrIEv2aetQFyfwIAg6ooOL40guZFcECFPHrOymxFKG6POfq6br36osQmckQO2LHzgTesMbm0Ay1rdMLDNN7A4hxeMP4NwAAgwP4l1nSk6WGYtTJYoeucbKhF8PIPZq5EcmtO9cwo0LHOAi82N0WjXrg+6YeF2xaGAZJsZsVeMWzbjXbLBlGuuaVrVPXiJ2TlUCQi71luraTnxknyVPDRjv3zXtGjmYEyZUJE96wRhgE8Wlrc2iYXua8s1tO48QvWj+vKzT9+J4B2wEmTzbyX8lSt/i/4n68e9/W0Pwwe83b5TecX22cnj1gh8FuWz7beaQZxuahCgpteT7C5XZhnJjBxozDFPbLR9UAjhCnkXmQUEzus+TicYBjdSrv5lw5nKHqFM58/mgmhz6H3f483cU1cCP3zi94iig5iu2q0KAKM7XkMoj1NtuMEjfW4Q1wiePG5mir6Zk1gakCbU68gVfAo3AzDGItdgMf7iJwN4rDYG02Ai8IocUPfDMznuMnG2C5nndufwOYAERCyOxlmP4Z9lvwyiDdAQFGfZof7nam5PahILb7wv+B5/NkwO7PhWcCcebjKyQa45Eq96CtJ/NC9+dAEcBTuHHmPgJ5JjIEU2eufjRN/gikQJmqvsQm8913uBR87mlL0+M0fZ1VBd+4gccK/Dgv4SgoI2RZFtD1O6G2Q81wIWTF8fB31ca7ISw0pwMlZhRXon0/rpeCdE66HGkSLSchTdYZtIwsTmB1knoWtNgTobU9LYrugjlamx8Z/QHeN5gblMlYLLRroZ53+8jKrNsov+oo8LLbvg6LGkr/xMhAGeQ2MkD9fJyr4EDPAVMMDbSOPyDrVf5Aa1zK7WradDl8R4KZitRAmZ/fAOllNx5tNR9u29m2rAh92IttnxuX4bmpIff7QkOVh+WmswVe2fXBSrEHrxPqcvP7wNOi7UmsW+7BNG4jsRL1+wvvbyQ81Jx1mi6KUBwvw0pful0je21/fOW9P+fvLbUl9z9RBv0GGgh5AwVF1CmqhAaD1UFFbUU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wZLVuy1ncWK8Vq4Rt+SIMJDBcxMcfUZC/wLru2vVQVoZe5wXKUhRng7K4w5bvidjKVvRHOotiyg6X82NC7bUURetKMajq2Pl5gXqiPpPeuRPAmvP8um+zTZiu0Gd0azHub1rGfpAgnihpDDwbJvLMjVuL7sREwqTNK27Ml346X1j6SpXmyn3P00V2NJaDFbQ+ZocL2HV5JuksjZ8V7RoNf7Vr7WFJbSiiPRN9LKTNieBi8nGLvjShUJb5rNOdwhgsDmVt0HSpZxKJngdZE8jsMYA0aiFILhJJzukkKWSp0gr0TtNRabMP1ZC/6eK+n+gHn8S2D12G3ceYVdh6vxoIVcE07kfayEa3FlZL2ozXswFLxcet1Nv13SrXo4WJm7bqyFS4NKCA4fq7jcYNabGweXbpLMZVNAuyhd2eJPDgEy3BKL/YbhB5zobyIwKS5YjTQIjW1b7ipCZZEx229az3Q1vhevzfVV7gymEw9YiN0kvRAEcNADFV1CJroIc2yjOU6wzEhhOuObdtZ8l7nb0VBK+R+tfT/ppiVufQfqfmXHq1iVc+InkWQVQ8RXgT5IsgXQb4I8kcR5PktsvLDV6xKUD5ggaLygvEXX7748sWXL778L+FL/F/myzveP3r64gTKoMXVOxRFym75o+sSXz+PfJWRVxl5lZFXGXlqGSG+4Nafsy5BvQjyRZAvgnwR5E8nyB+yLvH1c+AXX7748sWXL778WXz5b69L3PGe073fy2TvnDzoe5l//MSl4jOWO76juXmHRvz4Per9QYoBhYUVEiXq53fTrpDFy8DixK/PHODu5RPpj7arD80x4W8=</diagram></mxfile>
Binary file added docs/ai_actions/img/guide_ai_actions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8c90153

Please sign in to comment.