1. Go to this page and download the library: Download edgaras/azurellm library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
edgaras / azurellm example snippets
use Edgaras\AzureLLM\LLM;
$config = new LLM([
'apiKey' => '<YOUR-API-KEY>',
'endpoint' => 'https://<DEPLOYMENT>.openai.azure.com',
'deployment' => '<MODEL-DEPLOYMENT-ID>',
'apiVersion' => '<API-VERSION>'
]);
use Edgaras\AzureLLM\LLM;
use Edgaras\AzureLLM\AzureOpenAI;
$config = new LLM([
'apiKey' => '<YOUR-API-KEY>',
'endpoint' => 'https://<DEPLOYMENT>.openai.azure.com',
'deployment' => '<MODEL-DEPLOYMENT-ID>',
'apiVersion' => '<API-VERSION>'
]);
$azureLLM = new AzureOpenAI($config);
$inputMessages = [
['role' => 'system', 'content' => 'You are a helpful assistant.'],
['role' => 'user', 'content' => 'What is the capital of Lithuania?']
];
$options = [
"temperature" => 0.7,
"top_p" => 0.95,
"max_tokens" => 150
];
$response = $azureLLM->chatCompletions($inputMessages, $options);