Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250706) (a6b17d8f6bd)
aiprovider_openai\provider Class Reference
Inheritance diagram for aiprovider_openai\provider:
core_ai\provider

Public Member Functions

 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 this 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.
 

Static Public Member Functions

static get_action_list ()
 Get the list of actions that this provider supports.
 
static get_action_setting_defaults (string $action)
 Get the default settings for an action.
 
static get_action_settings (string $action, array $customdata=[],)
 Get any action settings for this provider.
 
static initialise_action_settings ()
 Initialise the action settings array.
 

Public Attributes

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
 

Member Function Documentation

◆ add_authentication_headers()

aiprovider_openai\provider::add_authentication_headers ( RequestInterface $request)

Update a request to add any headers required by the provider (if needed).

AI providers will need to override this method to add their own headers.

Parameters
RequestInterface$request
Return values
RequestInterface

Reimplemented from core_ai\provider.

◆ generate_userid()

core_ai\provider::generate_userid ( string $userid)
inherited

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$useridThe user id.
Return values
stringThe generated user id.

◆ get_action_list()

static aiprovider_openai\provider::get_action_list ( )
static

Get the list of actions that this provider supports.

Return values
arrayAn array of action class names.

Reimplemented from core_ai\provider.

◆ get_action_setting_defaults()

static aiprovider_openai\provider::get_action_setting_defaults ( string $action)
static

Get the default settings for an action.

Parameters
string$actionThe action class name.
Return values
arrayThe default settings for the action.

Reimplemented from core_ai\provider.

◆ get_action_settings()

static aiprovider_openai\provider::get_action_settings ( string $action,
array $customdata = [] )
static

Get any action settings for this provider.

Parameters
string$actionThe action class name.
array$customdataThe customdata for the form.
Return values
action_settings_form|boolThe settings form for this action or false in no settings.

Reimplemented from core_ai\provider.

◆ get_name()

core_ai\provider::get_name ( )
inherited

Get the name of the provider.

Return values
stringThe name of the provider.

◆ get_sub_actions()

core_ai\provider::get_sub_actions ( string $classname)
inherited

Given an action class name, return an array of sub actions that this provider supports.

Parameters
string$classnameThe action class name.
Return values
arrayAn array of supported sub actions.

◆ initialise_action_settings()

static core_ai\provider::initialise_action_settings ( )
staticinherited

Initialise the action settings array.

Return values
arrayThe initialised action settings.

◆ is_provider_configured()

aiprovider_openai\provider::is_provider_configured ( )

Check this provider has the minimal configuration to work.

Return values
boolReturn true if configured.

Reimplemented from core_ai\provider.

◆ is_request_allowed()

core_ai\provider::is_request_allowed ( aiactions\base $action)
inherited

Check if the request is allowed by the rate limiter.

Parameters
aiactions::base$actionThe action to check.
Return values
array|boolTrue on success, array of error details on failure.

◆ to_record()

core_ai\provider::to_record ( )
inherited

Convert this object to a stdClass, suitable for saving to the database.

Return values
stdClass

The documentation for this class was generated from the following file: