PHP code example of krzar / laravel-openai-api
1. Go to this page and download the library: Download krzar/laravel-openai-api 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/ */
krzar / laravel-openai-api example snippets
use KrZar\LaravelOpenAiApi\Chat\ChatConnector;
use KrZar\LaravelOpenAiApi\Chat\ValueObjects\ChatModel;
$chatConnector = new ChatConnector();
$response = $chatConnector->createCompletion('Send me random text', ChatModel::GPT4o);
bash
php artisan vendor:publish --provider="KrZar\OpenAi\OpenAiServiceProvider"