1. Go to this page and download the library: Download talleu/cohere-php-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/ */
talleu / cohere-php-client example snippets
use Talleu\CohereClient\Cohere;
$client = Cohere::client('your-api-key');
// Call the embed endpoint
$embeds = $client->embed()->create([
'Cohere is amazing!',
'Let’s try embedding some text.'
]);
var_dump($embeds);
$chat = $client->chat()->create([
[
'role' => 'user',
'content' => 'how are you ?'
]
]);