dolibarr 21.0.0-beta
Ai Class Reference

Class for AI. More...

Public Member Functions

 __construct ($db)
 Constructor.
 
 generateContent ($instructions, $model='auto', $function='textgeneration', $format='')
 Generate response of instructions.
 

Detailed Description

Class for AI.

Definition at line 34 of file ai.class.php.

Constructor & Destructor Documentation

◆ __construct()

Ai::__construct ( $db)

Constructor.

Parameters
DoliDB$dbDatabase handler

Definition at line 63 of file ai.class.php.

References getDolGlobalString().

Member Function Documentation

◆ generateContent()

Ai::generateContent ( $instructions,
$model = 'auto',
$function = 'textgeneration',
$format = '' )

Generate response of instructions.

Parameters
string$instructionsInstruction to generate content
string$modelModel name ('gpt-3.5-turbo', 'gpt-4-turbo', 'dall-e-3', ...)
string$functionCode of the feature we want to use ('textgeneration', 'transcription', 'audiogeneration', 'imagegeneration', 'translation')
string$formatFormat for output ('', 'html', ...)
Returns
string|array{error:bool,message:string,code?:int,curl_error_no?:''|int,format?:string,service?:string,function?:string} $response Text or array if error

Definition at line 81 of file ai.class.php.

References dol_nl2br(), dol_syslog(), dol_textishtml(), dol_trunc(), getDolGlobalString(), and getURLContent().


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