This repository has been archived by the owner on Nov 22, 2023. It is now read-only.
generated from spatie/package-skeleton-php
-
Notifications
You must be signed in to change notification settings - Fork 5
Home
Greg Priday edited this page Jul 7, 2021
·
4 revisions
This is a PHP wrapper for OpenAI's GPT-3 API. It's built on top of GuzzleHTTP.
You can install the package via composer:
composer require siteorigin/openai-api
Once you have everything installed, you can create a client and start making API calls.
use SiteOrigin\OpenAI\Client;
use SiteOrigin\OpenAI\Engines;
$client = new Client($_ENV['OPENAI_API_KEY']);
$completions = $client->completions(Engines::DAVINCI)->complete("The most important technology for humanity is", [
'max_tokens' => 32,
'temperature' => 0.8,
'n' => 4,
'stop' => ["\n", '.']
]);
Easy. Now we can dive into all the specific API calls.