class Ai (View source)

Class for AI

Constants

AI_DEFAULT_PROMPT_FOR_EMAIL

AI_DEFAULT_PROMPT_FOR_WEBPAGE

AI_DEFAULT_PROMPT_FOR_TEXT_TRANSLATION

AI_DEFAULT_PROMPT_FOR_TEXT_SUMMARIZE

AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER

AI_DEFAULT_PROMPT_FOR_EXTRAFIELD_FILLER

Properties

protected DoliDB $db

Methods

__construct(DoliDB $db)

Constructor

string|array{error: bool, message: string, code?: int, curl_error_no?: int, format?: string, service?: string, function?: string}
generateContent(string $instructions, string $model = 'auto', string $function = 'textgeneration', string $format = '')

Generate response of instructions

Details

__construct(DoliDB $db)

Constructor

Parameters

DoliDB $db

Database handler

string|array{error: bool, message: string, code?: int, curl_error_no?: int, format?: string, service?: string, function?: string} generateContent(string $instructions, string $model = 'auto', string $function = 'textgeneration', string $format = '')

Generate response of instructions

Parameters

string $instructions

Instruction to generate content

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')

string $format

Format for output ('', 'html', ...)

Return Value

string|array{error: bool, message: string, code?: int, curl_error_no?: int, format?: string, service?: string, function?: string}

$response Text or array if error