1. Go to this page and download the library: Download netresearch/nr-llm 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/ */
netresearch / nr-llm example snippets
use Netresearch\NrLlm\Service\LlmServiceManagerInterface;
class MyController
{
public function __construct(
private readonly LlmServiceManagerInterface $llm,
) {}
public function summarizeAction(string $text): string
{
return $this->llm->complete("Summarize: {$text}")->content;
}
}