|
dolibarr 24.0.0-beta
|
Public Member Functions | |
| __construct (string $type, string $key, string $baseUrl, string $model, int $timeout) | |
| Constructor. | |
| generate (string $system, string $userMsg, string $mode='text') | |
| Generate a response using the configured LLM provider. | |
Private Member Functions | |
| callOpenAI (string $sys, string $msg, string $mode='text') | |
| Call OpenAI-compatible API. | |
| callAnthropic (string $sys, string $msg, string $mode='text') | |
| Call Anthropic API (Claude) | |
| callGoogle (string $sys, string $msg, string $mode='text') | |
| Call Google Gemini API. | |
| curl (string $url, array $data, array $headers, bool $isClaude=false, bool $isGemini=false) | |
| Execute HTTP Request via cURL. | |
Definition at line 26 of file llmadapter.class.php.
| UniversalLLMAdapter::__construct | ( | string | $type, |
| string | $key, | ||
| string | $baseUrl, | ||
| string | $model, | ||
| int | $timeout ) |
Constructor.
| string | $type | The LLM type |
| string | $key | API Key |
| string | $baseUrl | API Base URL |
| string | $model | Model name |
| int | $timeout | Timeout in seconds |
Definition at line 58 of file llmadapter.class.php.
References type.
Call Anthropic API (Claude)
| string | $sys | System prompt |
| string | $msg | User message |
| string | $mode | Response mode (default: text) |
Definition at line 134 of file llmadapter.class.php.
References curl().
Referenced by generate().
Call Google Gemini API.
| string | $sys | System prompt |
| string | $msg | User message |
| string | $mode | Response mode (default: text) |
Definition at line 160 of file llmadapter.class.php.
References curl().
Referenced by generate().
Call OpenAI-compatible API.
| string | $sys | System prompt |
| string | $msg | User message |
| string | $mode | 'json' or 'text' |
Definition at line 95 of file llmadapter.class.php.
References curl().
Referenced by generate().
|
private |
Execute HTTP Request via cURL.
| string | $url | Target API URL |
| array<string,mixed> | $data Request payload (keys are strings, values vary) | |
| array<int,string> | $headers List of HTTP headers (indexed array of strings) | |
| bool | $isClaude | Flag to handle Anthropic response format |
| bool | $isGemini | Flag to handle Gemini response format |
Definition at line 196 of file llmadapter.class.php.
References getURLContent(), and string.
Referenced by callAnthropic(), callGoogle(), and callOpenAI().
Generate a response using the configured LLM provider.
| string | $system | The system prompt/instruction |
| string | $userMsg | The specific user query |
| string | $mode | 'json' for strict JSON (MCP), 'text' for legacy (default) |
Definition at line 75 of file llmadapter.class.php.
References callAnthropic(), callGoogle(), callOpenAI(), and type.