|
| __construct (public bool readonly bool $enabled, public string string $name, string $config, string $actionconfig='', public null|int readonly ?int $id=null,) |
| Create a new provider.
|
|
| add_authentication_headers (RequestInterface $request) |
| Update a request to add any headers required by the provider (if needed).
|
|
| generate_userid (string $userid) |
| Generate a user id.
|
|
| get_name () |
| Get the name of the provider.
|
|
| get_sub_actions (string $classname) |
| Given an action class name, return an array of sub actions that this provider supports.
|
|
| is_provider_configured () |
| Check if a provider has the minimal configuration to work.
|
|
| is_request_allowed (aiactions\base $action) |
| Check if the request is allowed by the rate limiter.
|
|
| to_record () |
| Convert this object to a stdClass, suitable for saving to the database.
|
|
|
array readonly array | $actionconfig |
| The action specific settings for this instance.
|
|
array readonly array | $config |
| The configuration for this instance.
|
|
string readonly string | $provider |
| $provider The provider used to make this instance
|
|
◆ __construct()
core_ai\provider::__construct |
( |
public bool readonly bool | $enabled, |
|
|
public string string | $name, |
|
|
string | $config, |
|
|
string | $actionconfig = '', |
|
|
public null|int readonly ?int | $id = null ) |
Create a new provider.
- Parameters
-
bool | $enabled | Whether the gateway is enabled |
string | $name | The name of the provider config. |
string | $config | The configuration for this instance. |
string | $actionconfig | The action specific settings for this instance. |
int | null | $id | The id of the provider in the database. |
- Parameters
-
$enabled | Whether the gateway is enabled |
$name | The name of the provider config. |
$id | The ID of the provider in the database, or null if it has not been persisted yet. |
◆ add_authentication_headers()
◆ generate_userid()
core_ai\provider::generate_userid |
( |
string | $userid | ) |
|
Generate a user id.
This is a hash of the site id and user id, this means we can determine who made the request but don't pass any personal data to the AI provider.
- Parameters
-
string | $userid | The user id. |
- Return values
-
string | The generated user id. |
◆ get_action_list()
static core_ai\provider::get_action_list |
( |
| ) |
|
|
staticabstract |
◆ get_action_setting_defaults()
static core_ai\provider::get_action_setting_defaults |
( |
string | $action | ) |
|
|
static |
◆ get_action_settings()
static core_ai\provider::get_action_settings |
( |
string | $action, |
|
|
array | $customdata = [] ) |
|
static |
◆ get_name()
core_ai\provider::get_name |
( |
| ) |
|
Get the name of the provider.
- Return values
-
string | The name of the provider. |
◆ get_sub_actions()
core_ai\provider::get_sub_actions |
( |
string | $classname | ) |
|
Given an action class name, return an array of sub actions that this provider supports.
- Parameters
-
string | $classname | The action class name. |
- Return values
-
array | An array of supported sub actions. |
◆ initialise_action_settings()
static core_ai\provider::initialise_action_settings |
( |
| ) |
|
|
static |
Initialise the action settings array.
- Return values
-
array | The initialised action settings. |
◆ is_provider_configured()
core_ai\provider::is_provider_configured |
( |
| ) |
|
◆ is_request_allowed()
Check if the request is allowed by the rate limiter.
- Parameters
-
aiactions::base | $action | The action to check. |
- Return values
-
array|bool | True on success, array of error details on failure. |
◆ to_record()
core_ai\provider::to_record |
( |
| ) |
|
Convert this object to a stdClass, suitable for saving to the database.
- Return values
-
The documentation for this class was generated from the following file:
- ai/provider/openai/classes/provider.php