PHP code example of maryushenina / ai-client-sdk

1. Go to this page and download the library: Download maryushenina/ai-client-sdk 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/ */

    

maryushenina / ai-client-sdk example snippets


use GuzzleHttp\Client;
use MaryUshenina\AiClientSdk\OpenAIClient;

$client = new OpenAIClient(new Client(), 'your-api-key');

$response = $client->complete([
    ['role' => 'system', 'content' => 'You are a helpful assistant.'],
    ['role' => 'user', 'content' => 'What is PHP?']
]);

echo $response;