Skip to content

Commit f7e9cae

Browse files
authored
Use absolute links to PHP API Ref (#2669)
1 parent 24add14 commit f7e9cae

File tree

131 files changed

+369
-372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+369
-372
lines changed

docs/ai_actions/extend_ai_actions.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ For example, you can create a handler that connects to a translation model and u
1111

1212
## Execute Actions
1313

14-
You can execute AI Actions by using the [ActionServiceInterface](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionServiceInterface.html) service, as in the following example:
14+
You can execute AI Actions by using the [ActionServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionServiceInterface.html) service, as in the following example:
1515

1616
``` php
1717
[[= include_file('code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php', 102, 121) =]]
1818
```
1919

20-
The `GenerateAltTextAction` is a built-in action that implements the [ActionInterface](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html), takes an [Image](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-DataType-Image.html) as an input, and generates the alternative text in the response.
20+
The `GenerateAltTextAction` is a built-in action that implements the [ActionInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html), takes an [Image](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-DataType-Image.html) as an input, and generates the alternative text in the response.
2121

22-
This action is parameterized with the [RuntimeContext](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-RuntimeContext.html) and the [ActionContext](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-ActionContext.html), which allows you to pass additional options to the Action before it's executed.
22+
This action is parameterized with the [RuntimeContext](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-RuntimeContext.html) and the [ActionContext](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-ActionContext.html), which allows you to pass additional options to the Action before it's executed.
2323

2424
| Type of context | Type of options | Usage | Example |
2525
|---|---|---|---|
@@ -28,17 +28,17 @@ This action is parameterized with the [RuntimeContext](../api/php_api/php_api_re
2828
| Action Context | Action Handler options | Sets additional parameters for the Action Handler | Information about the model, temperature, prompt, and max tokens allowed |
2929
| Action Context | System options | Sets additional information, not matching the other option collections | Information about the fallback locale |
3030

31-
Both `ActionContext` and `RuntimeContext` are passed to the Action Handler (an object implementing the [ActionHandlerInterface](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-ActionHandlerInterface.html)) to execute the action. The Action Handler is responsible for combining all the options together, sending them to the AI service and returning an [ActionResponse](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionResponseInterface.html).
31+
Both `ActionContext` and `RuntimeContext` are passed to the Action Handler (an object implementing the [ActionHandlerInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-ActionHandlerInterface.html)) to execute the action. The Action Handler is responsible for combining all the options together, sending them to the AI service and returning an [ActionResponse](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionResponseInterface.html).
3232

3333
You can pass the Action Handler directly to the `ActionServiceInterface::execute()` method, which overrides all the other ways of selecting the Action Handler.
3434
You can also specify the Action Handler by including it in the provided [Action Configuration](#action-configurations).
3535
In other cases, the Action Handler is selected automatically.
36-
You can affect this choice by creating your own class implementing the [ActionHandlerResolverInterface](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-ActionHandlerResolverInterface.html) or by listening to the [ResolveActionHandlerEvent](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Events-ResolveActionHandlerEvent.html) Event sent by the default implementation.
36+
You can affect this choice by creating your own class implementing the [ActionHandlerResolverInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-ActionHandlerResolverInterface.html) or by listening to the [ResolveActionHandlerEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Events-ResolveActionHandlerEvent.html) Event sent by the default implementation.
3737

3838
You can influence the execution of an Action with two events:
3939

40-
- [BeforeExecuteEvent](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-Event-BeforeExecuteEvent.html), fired before the Action is executed
41-
- [ExecuteEvent](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-Event-ExecuteEvent.html), fired after the Action is executed
40+
- [BeforeExecuteEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-Event-BeforeExecuteEvent.html), fired before the Action is executed
41+
- [ExecuteEvent](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-Event-ExecuteEvent.html), fired after the Action is executed
4242

4343
Below you can find the full example of a Symfony Command, together with a matching service definition.
4444
The command finds the images modified in the last 24 hours, and adds the alternative text to them if it's missing.
@@ -61,13 +61,13 @@ To manage configurations of an AI Action you need to use another concept: Action
6161
Action Configurations allow you to store the parameters for a given Action in the database and reuse them when needed.
6262
They can be managed [through the back office]([[= user_doc =]]/ai_actions/work_with_ai_actions/), [data migrations](importing_data.md#ai-action-configurations), or through the PHP API.
6363

64-
To manage Action Configurations through the PHP API, you need to use the [ActionConfigurationServiceInterface](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionConfigurationServiceInterface.html) service.
64+
To manage Action Configurations through the PHP API, you need to use the [ActionConfigurationServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionConfigurationServiceInterface.html) service.
6565

6666
You can manage them using the following methods:
6767

68-
- Creating them with `ActionConfigurationServiceInterface::createActionConfiguration()` by passing the [ActionConfigurationCreateStruct](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionConfiguration-ActionConfigurationCreateStruct.html).
69-
- Updating them with `ActionConfigurationServiceInterface::updateActionConfiguration()` by passing the [ActionConfigurationUpdateStruct](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionConfiguration-ActionConfigurationUpdateStruct.html).
70-
- Deleting them with `ActionConfigurationServiceInterface::deleteActionConfiguration()` by passing the [ActionConfigurationInterface](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionConfigurationInterface.html).
68+
- Creating them with `ActionConfigurationServiceInterface::createActionConfiguration()` by passing the [ActionConfigurationCreateStruct](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionConfiguration-ActionConfigurationCreateStruct.html).
69+
- Updating them with `ActionConfigurationServiceInterface::updateActionConfiguration()` by passing the [ActionConfigurationUpdateStruct](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionConfiguration-ActionConfigurationUpdateStruct.html).
70+
- Deleting them with `ActionConfigurationServiceInterface::deleteActionConfiguration()` by passing the [ActionConfigurationInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionConfigurationInterface.html).
7171

7272
See the [AI Actions event reference](ai_action_events.md#action-configurations-management) for a list of events related to these operations.
7373

@@ -91,7 +91,7 @@ You can pass one directly to the `ActionServiceInterface::execute()` method:
9191
[[= include_file('code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php', 77, 85) =]]
9292
```
9393

94-
The passed Action Configuration is only taken into account if the Action Context was not passed to the Action directly using the [ActionInterface::setActionContext()](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html#method_hasActionContext) method.
94+
The passed Action Configuration is only taken into account if the Action Context was not passed to the Action directly using the [ActionInterface::setActionContext()](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html#method_hasActionContext) method.
9595
The `ActionServiceInterface` service extracts the configuration options from the Action Configuration object and builds the Action Context object internally:
9696

9797
- Action Type options are mapped to Action Type options in the Action Context
@@ -106,7 +106,7 @@ The following example adds a new Action Handler connecting to a local AI run usi
106106

107107
### Register a custom Action Handler in the system.
108108

109-
Create a class implementing the [ActionHandlerInterface](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-ActionHandlerInterface.html) and register it as a service:
109+
Create a class implementing the [ActionHandlerInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-ActionHandlerInterface.html) and register it as a service:
110110

111111
- The `ActionHandlerInterface::supports()` method decides whether the Action Handler is able to execute given Action.
112112
- The `ActionHandlerInterface::handle()` method is responsible for combining all the Action options together, sending them to the AI service and forming an Action Response.
@@ -151,7 +151,7 @@ The Action Handler and Action Type options are rendered in the back office using
151151
![Custom Action Handler options rendered using the default Twig options formatter](img/action_handler_options.png "Custom Action Handler options rendered using the default Twig options formatter")
152152

153153

154-
You can create your own formatting by creating a class implementing the [OptionsFormatterInterface](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionConfiguration-OptionsFormatterInterface.html) interface and aliasing it to `Ibexa\Contracts\ConnectorAi\ActionConfiguration\OptionsFormatterInterface`.
154+
You can create your own formatting by creating a class implementing the [OptionsFormatterInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionConfiguration-OptionsFormatterInterface.html) interface and aliasing it to `Ibexa\Contracts\ConnectorAi\ActionConfiguration\OptionsFormatterInterface`.
155155

156156
The following service definition switches the options rendering to the other built-in options formatter, displaying the options as JSON.
157157

@@ -168,7 +168,7 @@ The following example shows how to implement a custom Action Type dedicated for
168168

169169
### Create custom Action Type
170170

171-
Start by creating your own Action Type, a class implementing the [ActionTypeInterface](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionType-ActionTypeInterface.html).
171+
Start by creating your own Action Type, a class implementing the [ActionTypeInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionType-ActionTypeInterface.html).
172172
The class needs to define following parameters of the Action Type:
173173

174174
- name
@@ -188,7 +188,7 @@ The class needs to define following parameters of the Action Type:
188188
The service definition introduces a custom `app.connector_ai.action.handler.audio_to_text` service tag to mark all the handlers capable of working with this Action Type.
189189
The `ibexa.ai.action.type` service tag registers the class in the service container as a new Action Type.
190190

191-
If the Action Type is meant to be used mainly with prompt-based systems you can use the [LLMBaseActionTypeInterface](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-LLMBaseActionTypeInterface.html) interface as the base for your Action Type.
191+
If the Action Type is meant to be used mainly with prompt-based systems you can use the [LLMBaseActionTypeInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-Action-LLMBaseActionTypeInterface.html) interface as the base for your Action Type.
192192
It allows you to define a base prompt directly in the Action Type that can be common for all Action Configurations.
193193

194194
Action Type names can be localized using the Translation component.
@@ -198,13 +198,13 @@ See the built-in Action Types like Generate Alt Text or Refine Text for an examp
198198

199199
The `TranscribeAudio` Action Type requires adding two data classes that exist in its definition:
200200

201-
- an `Audio` class, implementing the [DataType interface](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-DataType.html), to store the input data for the Action
201+
- an `Audio` class, implementing the [DataType interface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-DataType.html), to store the input data for the Action
202202

203203
``` php
204204
[[= include_file('code_samples/ai_actions/src/AI/DataType/Audio.php') =]]
205205
```
206206

207-
- an `TranscribeAudioAction` class, implementing the [ActionInterface interface](../api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html). Pass this object to the `ActionServiceInterface::execute()` method to execute the action.
207+
- an `TranscribeAudioAction` class, implementing the [ActionInterface interface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ConnectorAi-ActionInterface.html). Pass this object to the `ActionServiceInterface::execute()` method to execute the action.
208208

209209
``` php
210210
[[= include_file('code_samples/ai_actions/src/AI/Action/TranscribeAudioAction.php') =]]

0 commit comments

Comments
 (0)