-
Notifications
You must be signed in to change notification settings - Fork 81
IBX-8689: AI Actions documentation #2473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
2188724
5db48c2
9eaf572
351fe83
9abac00
af41b70
5f3dde3
938fa1e
341e838
72927f7
fd4b0b5
4dfaf1b
31c4482
89fc0d5
90629bc
53b6713
028cc1f
5c66139
b4714ef
ba1c07b
c8ee8ed
1213f01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| 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); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| --- | ||
|
Check warning on line 1 in docs/ai_actions/ai_actions.md
|
||
| description: AI Actions help editors by automating repetitive tasks. | ||
| page_type: landing_page | ||
| --- | ||
|
|
||
| # 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) =]] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| --- | ||
|
Check warning on line 1 in docs/ai_actions/ai_actions_guide.md
|
||
| description: AI Actions LTS update helps editors by automating repetitive tasks. | ||
| --- | ||
|
|
||
| # AI Actions product guide | ||
|
|
||
| ## What are AI Actions | ||
|
|
||
| In the evolving landscape of digital experience, 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, 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 includes two essential components: a framework package and an OpenAI connector package. | ||
| It comes pre-configured with the following action types: | ||
dabrt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - [Refine text](#refining-text): Rewrite existing text according to parameters set in a prompt | ||
dabrt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - [Generate alternative text](#generating-alternative-text): Generate alt text for accessibility purposes | ||
dabrt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|  | ||
|
|
||
| You can extend its capabilities beyond the default setup by creating custom connector modules, allowing users to integrate additional AI services or customize the way data is processed and interpreted. | ||
dabrt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 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 | ||
|
Check warning on line 34 in docs/ai_actions/ai_actions_guide.md
|
||
|
|
||
| AI Actions LTS update is built upon the PHP framework. | ||
dabrt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| The framework package 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 the AI service is set to perform. | ||
dabrt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 templates predefined by developers. | ||
dabrt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Each AI action type defines the structure and nature of the task that the AI service performs. | ||
| AI action types could be designed, for example, to generate text based on an image, translate a passage of text, or generate a video clip based on a description. | ||
| 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. | ||
|
|
||
| #### Models | ||
|
|
||
| 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 for: | ||
|
|
||
| - AI action management in the **Admin** panel | ||
| - text modification in online editor | ||
| - alt-text generation feature in the image management modal | ||
dabrt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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. | ||
|
|
||
|  | ||
|
|
||
| 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 to <insert_a description and link to Marek's use case> generate complete articles based on a short description, or illustrations based on a body of an article. | ||
dabrt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Use cases | ||
|
Check warning on line 121 in docs/ai_actions/ai_actions_guide.md
|
||
|
|
||
| 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. | ||
|
|
||
|  | ||
|
|
||
| With seamless with the content creation UI in mind, this functionality is available in content types that include a RichText field, and certain Page Builder blocks. | ||
dabrt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### 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. | ||
|
|
||
|  | ||
|
|
||
| With some customization, administrators could use the API to run a batch process against a larger collection of illustrations. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
|
Check warning on line 1 in docs/ai_actions/extend_ai_actions.md
|
||
| description: Extend AI Actions by connecting to other services and adding new capabilities. | ||
| --- | ||
|
|
||
| # 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. | ||
|
|
||
| ## ... | ||
| 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+6YeF2xaGAZJsZsVeMWzbjXbLBlGuuaVrVPXiJ2TlUCQi71luraTnxknyVPDRjv3z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JngdZE8jsMYA0aiFILhJJzukkKWSp0gr0TtNRabMP1ZC/6eK+n+gHn8S2D12G3ceYVdh6vxoIVcE07kfayEa3FlZL2ozXswFLxcet1Nv13SrXo4WJm7bqyFS4NKCA4fq7jcYNabGweXbpLMZVNAuyhd2eJPDgEy3BKL/YbhB5zobyIwKS5YjTQIjW1b7ipCZZEx229az3Q1vhevzfVV7gymEw9YiN0kvRAEcNADFV1CJroIc2yjOU6wzEhhOuObdtZ8l7nb0VBK+R+tfT/ppiVufQfqfmXHq1iVc+InkWQVQ8RXgT5IsgXQb4I8kcR5PktsvLDV6xKUD5ggaLygvEXX7748sWXL778L+FL/F/myzveP3r64gTKoMXVOxRFym75o+sSXz+PfJWRVxl5lZFXGXlqGSG+4Nafsy5BvQjyRZAvgnwR5E8nyB+yLvH1c+AXX7748sWXL778WXz5b69L3PGe073fy2TvnDzoe5l//MSl4jOWO76juXmHRvz4Per9QYoBhYUVEiXq53fTrpDFy8DixK/PHODu5RPpj7arD80x4W8=</diagram></mxfile> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| --- | ||
|
Check warning on line 1 in docs/ai_actions/install_ai_actions.md
|
||
| description: Install the AI Actions LTS update. | ||
| --- | ||
|
|
||
| # Install AI Actions | ||
|
|
||
| AI Actions are available as an LTS update to [[= product_name =]] in version v4.6.x or higher, regardless of its edition. | ||
| To use this feature you must first install the packages and configure them. | ||
|
|
||
| ## Install packages | ||
|
|
||
| Run the following command to install the bundle: | ||
dabrt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ``` bash | ||
| composer require ibexa/connector-ai | ||
| composer require ibexa/connector-openai | ||
| ``` | ||
|
|
||
| This command adds the framework code, a service connector with the OpenAI service, service handlers, Twig templates, and configurations required for using AI Actions. | ||
| It also modifies the permission system to account for the new functionality. | ||
|
|
||
| ## Configure AI Actions | ||
|
|
||
| Once the packages are installed, before you can start using AI Actions, you must enable them by following these instructions. | ||
|
|
||
| ### Configure access to OpenAI | ||
|
|
||
| Create an OpenAI account, [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). | ||
|
|
||
| Then, in the root folder of your project, modify the `.env` file: find the `OPENAI_API_KEY` key and replace a placeholder value with the API key that you got from the AI service. | ||
dabrt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```bash | ||
| ###> ibexa/connector-openai ### | ||
| OPENAI_API_KEY=sk-svcacct-AFCrCt1h2s3i4s5i6s7t8h9e0a1p2i3c4o5d6e | ||
| ###< ibexa/connector-openai ### | ||
| ``` | ||
|
|
||
| ### Modify the database schema | ||
|
|
||
| Create the `add_ai_actions.sql` file that contains the following code: | ||
|
|
||
| ```sql | ||
| [[= include_file('code_samples/ai_actions/config/add_ai_actions.sql') =]] | ||
| ``` | ||
|
|
||
| Run the following command. where `<database_name>` is the same name that you defined when you [installed [[= product_name =]]](../getting_started/install_ibexa_dxp.md#change-installation-parameters). | ||
|
|
||
| ```bash | ||
| mysql -u root <database_name> < add_ai_actions.sql | ||
| ``` | ||
dabrt marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| This command modifies the existing database schema by adding database configuration required for using AI Actions. | ||
|
|
||
| You can now restart you application and start [working with the AI Actions feature]([[= user_doc =]]/ai_actions/work_with_ai_actions//). | ||
|
|
||
| ### Install sample AI action configurations (optional) | ||
|
|
||
| By installing a collection of sample AI action configurations you can quickly start using the feature. | ||
| You do it by following a standard [data migration](importing_data.md) procedure: | ||
|
|
||
| ```bash | ||
| php bin/console ibexa:migrations:import vendor/ibexa/connector-openai/src/bundle/Resources/migrations/action_configurations.yaml | ||
| php bin/console ibexa:migrations:migrate | ||
| ``` | ||
|
|
||
| Based on these examples, which reflect the most common use cases, you can learn to configure your own AI actions with greater ease. | ||
Uh oh!
There was an error while loading. Please reload this page.