1. Go to this page and download the library: Download partitech/php-tei-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/ */
partitech / php-tei-client example snippets
use Partitech\PhpTeiClient\TeiClient;
$client = new TeiClient(url: 'http://localhost:8080', apiKey: 'yourApiKey');
// Embed a single string
$result = $client->embed(content: 'What is Deep Learning?');
// Embed an array of strings
$contents = ['What is Deep Learning?', 'What is Machine Learning?'];
$result = $client->embed(content: $contents);
use Partitech\PhpTeiClient\TeiClient;
$client = new TeiClient(url: 'http://localhost:8080', apiKey: 'yourApiKey');
// Rerank an array of texts based on a query
$content = ['Deep learning is...', 'cheese is made of', 'Deep Learning is not...'];
$result = $client->rerank('What is the difference between Deep Learning and Machine Learning?', $content);
use Partitech\PhpTeiClient\TeiClient;
$client = new TeiClient(url: 'http://localhost:8080', apiKey: 'yourApiKey');
// Rerank an array of texts based on a query
$content = ['Deep learning is...', 'cheese is made of', 'Deep Learning is not...'];
$result = $client->getRerankedContent('What is the difference between Deep Learning and Machine Learning?', $content);
use Partitech\PhpTeiClient\TeiClient;
$client = new TeiClient(url: 'http://localhost:8080', apiKey: 'yourApiKey');
// Predict the sentiment of a string
$result = $client->predict('I love this product!');
use Partitech\PhpTeiClient\TeiClient;
$client = new TeiClient(url: 'http://localhost:8080', apiKey: 'yourApiKey');
$result = $client->embedSparse(content: 'What is Deep Learning?');