PHP code example of alex8bits / ai_client

1. Go to this page and download the library: Download alex8bits/ai_client 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/ */

    

alex8bits / ai_client example snippets

bash
php artisan vendor:publish --provider="Alex8bits\AiClient\ChatGPTServiceProvider" --tag=config

{
    "type": "function",
    "function": {
        "name": "getWeather",
        "arguments": "{ \"city\": \"Москва\" }"
    }
}

$response->choices[0]->content;
$response->choices[0]->functionCall?->name;
$response->raw;     // полный JSON