PHP code example of hch / chatgpt-integration-bundle
1. Go to this page and download the library: Download hch/chatgpt-integration-bundle 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/ */
hch / chatgpt-integration-bundle example snippets
use HCH\ChatGPTIntegrationBundle\Service\ChatGPTClient;
class SomeService
{
private $chatGPTClient;
public function __construct(ChatGPTClient $chatGPTClient)
{
$this->chatGPTClient = $chatGPTClient;
}
public function getResponseFromChatGPT(string $message): string
{
return $this->chatGPTClient->ask($message);
}
}
bash
php bin/phpunit