PHP code example of panix / yii2-chatgpt
1. Go to this page and download the library: Download panix/yii2-chatgpt 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/ */
panix / yii2-chatgpt example snippets
'components' => [
'chatgpt' => [
'class' => 'panix\ext\chatgpt\ChatGPT',
'apikey' => 'YOUR_API_KEY', //
$gpt = Yii::$app->chatgpt->completion([
'model' => 'text-davinci-003',
'prompt' => 'Hello',
'temperature' => 0.9,
'max_tokens' => 150,
'frequency_penalty' => 0,
'presence_penalty' => 0.6,
]);
print_r($gpt);
php composer