|
dolibarr 25.0.0-alpha
|
Class for AI feature. More...

Public Member Functions | |
| __construct ($db) | |
| Constructor. | |
| getApiService () | |
| get API Service | |
| generateContent ($instructions, $model='auto', $function='textgeneration', $format='', $moreheaders=array(), $moreendpoint='') | |
| Generate the response of an AI prompt. | |
| decodeJsonIntoArray ($json, $type) | |
| Decode JSON into array. | |
Class for AI feature.
Definition at line 35 of file ai.class.php.
| Ai::__construct | ( | $db | ) |
| Ai::decodeJsonIntoArray | ( | $json, | |
| $type ) |
Decode JSON into array.
| array{document_info?:array{reference?:string,invoice_number?:string,title?:string,issue_date?:string,due_date?:string,vendor?:array{name?:string,siren?:string,siret?:string,email?:string,professional_id?:array{siren?:string},vat_number?:string}}|null,summary?:array{currency?:string,subtotal_excluding_tax?:float,tax?:array{rate?:float,amount?:float}},items?:array<int|string,array{description?:string,service?:string,quantity?:float,tax?:array{vat_rate?:float,rate?:float,amount?:float},unit_price?:float,total_excluding_tax?:float,total_including_tax?:float,period_start?:string,period_end?:string,period?:array{start_date?:string,end_date?:string}}>} | $json JSON | |
| string | $type | Type of document to get ('supplier_invoice', 'thirdparty', ...) |
Definition at line 505 of file ai.class.php.
References dol_stringtotime().
| Ai::generateContent | ( | $instructions, | |
| $model = 'auto', | |||
| $function = 'textgeneration', | |||
| $format = '', | |||
| $moreheaders = array(), | |||
| $moreendpoint = '' ) |
Generate the response of an AI prompt.
| string|array<mixed,mixed> | $instructions String instruction to generate content (or file path) or array of payload or ID of file with function threads | |
| string | $model | Model name ('gpt-4.1-turbo', 'gpt-4.1', 'dall-e-3', ...) |
| string | $function | Code of the feature we want to use ('textgeneration', 'transcription', 'audiogeneration', 'imagegeneration', 'translation', 'docparsing') |
| string | $format | Format for output ('', 'html', ...) |
| array<string,string> | $moreheaders More headers | |
| string | $moreendpoint | Add a part to endpoint url |
Definition at line 102 of file ai.class.php.
References dol_nl2br(), dol_now(), dol_print_date(), dol_syslog(), dol_textishtml(), dol_trunc(), dolChmod(), getDolGlobalString(), getListOfAIServices(), and getURLContent().
| Ai::getApiService | ( | ) |