Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250706) (a6b17d8f6bd)
aiprovider_openai\abstract_processor Class Reference
Inheritance diagram for aiprovider_openai\abstract_processor:
core_ai\process_base aiprovider_openai\process_generate_image aiprovider_openai\process_generate_text aiprovider_openai\process_explain_text aiprovider_openai\process_summarise_text

Public Member Functions

 process ()
 Process the AI request.
 

Protected Member Functions

 create_request_object (string $userid,)
 Create the request object to send to the OpenAI API.
 
 get_endpoint ()
 Get the endpoint URI.
 
 get_model ()
 Get the name of the model to use.
 
 get_model_settings ()
 Get the model settings.
 
 get_response (... $args)
 Get the instantiated Response Class for the action described by this processor.
 
 get_system_instruction ()
 Get the system instructions.
 
 handle_api_error (ResponseInterface $response)
 Handle an error from the external AI api.
 
 handle_api_success (ResponseInterface $response)
 Handle a successful response from the external AI api.
 
 query_ai_api ()
 Query the AI service.
 

Member Function Documentation

◆ create_request_object()

aiprovider_openai\abstract_processor::create_request_object ( string $userid)
abstractprotected

Create the request object to send to the OpenAI API.

This object contains all the required parameters for the request.

Parameters
string$useridThe user id.
Return values
RequestInterfaceThe request object to send to the OpenAI API.

Reimplemented in aiprovider_openai\process_generate_image, and aiprovider_openai\process_generate_text.

◆ get_endpoint()

aiprovider_openai\abstract_processor::get_endpoint ( )
protected

Get the endpoint URI.

Return values
UriInterface

◆ get_model()

aiprovider_openai\abstract_processor::get_model ( )
protected

Get the name of the model to use.

Return values
string

◆ get_model_settings()

aiprovider_openai\abstract_processor::get_model_settings ( )
protected

Get the model settings.

Return values
array

◆ get_response()

core_ai\process_base::get_response ( ...)
protectedinherited

Get the instantiated Response Class for the action described by this processor.

Parameters
mixed...$args The arguments to pass to the response class constructor.
Return values
response_base

◆ get_system_instruction()

aiprovider_openai\abstract_processor::get_system_instruction ( )
protected

Get the system instructions.

Return values
string

Reimplemented in aiprovider_openai\process_generate_text.

◆ handle_api_error()

aiprovider_openai\abstract_processor::handle_api_error ( ResponseInterface $response)
protected

Handle an error from the external AI api.

Parameters
ResponseInterface$responseThe response object.
Return values
arrayThe error response.

◆ handle_api_success()

aiprovider_openai\abstract_processor::handle_api_success ( ResponseInterface $response)
abstractprotected

Handle a successful response from the external AI api.

Parameters
ResponseInterface$responseThe response object.
Return values
arrayThe response.

Reimplemented in aiprovider_openai\process_generate_image, and aiprovider_openai\process_generate_text.

◆ process()

core_ai\process_base::process ( )
inherited

Process the AI request.

Return values
response_baseThe result of the action.

◆ query_ai_api()

aiprovider_openai\abstract_processor::query_ai_api ( )
protected

Query the AI service.

Return values
arrayThe response from the AI service.

Reimplemented from core_ai\process_base.

Reimplemented in aiprovider_openai\process_generate_image.


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