1. Go to this page and download the library: Download partitech/php-mistral 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/ */
use Partitech\PhpMistral\Clients\Tei\TeiClient;
$client = new TeiClient(apiKey: $apiKey, url: $embeddingUrl);
$embedding = $client->embed(inputs: "My name is Olivier and I");
$client = new TeiClient(apiKey: (string) $apiKey, url: $teiUrl);
$embedding = $client->embedSparse(inputs: 'What is Deep Learning?');
var_dump($embedding);
$client = new TeiClient(apiKey: $apiKey, url: $teiUrl);
$results = $client->rerank(
query: 'What is the difference between Deep Learning and Machine Learning?',
texts: [
'Deep learning is...',
'cheese is made of',
'Deep Learning is not...'
]
);