Hungging Face TGI

Health

Code

use Partitech\PhpMistral\Clients\Tgi\TgiClient;

$apiKey = getenv('HUGGINGFACE_TGI_TOKEN');
$tgiUrl = getenv('TGI_URL');

$client = new TgiClient(apiKey: (string) $apiKey, url: $tgiUrl);
try {
    $health = $client->health();
    var_dump($health)
} catch (\Partitech\PhpMistral\MistralClientException $e) {
    
}

Result

bool(true)

if health is not ok

{ "error": "unhealthy", "error_type": "healthcheck" }