1. Go to this page and download the library: Download lenorix/ai 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/ */
lenorix / ai example snippets
use Lenorix\Ai\Provider\DeepSeek;
use Lenorix\Ai\AiText;
use Lenorix\Ai\Chat\ToolFromLambda;
AiText::generate(
provider: new DeepSeek('deepseek-chat', 'sk-********************************'),
tools: [
// This is only an example, you can create your tool extending from CoreTool base class.
new ToolFromLambda(
fn ($city = 'madrid') => $city . ' is sunny',
'weather',
'get weather updated'
),
],
system: 'help users to know the weather with updated information',
prompt: 'tell me the weather',
messages: [
['role' => 'user', 'content' => 'hello'],
['role' => 'assistant', 'content' => 'hi!']
],
maxSteps: 50
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.