PHP code example of papi-ai / mistral
1. Go to this page and download the library: Download papi-ai/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/ */
papi-ai / mistral example snippets
use PapiAI\Core\Agent;
use PapiAI\Mistral\MistralProvider;
$provider = new MistralProvider(
apiKey: $_ENV['MISTRAL_API_KEY'],
);
$agent = new Agent(
provider: $provider,
instructions: 'You are a helpful assistant.',
);
$response = $agent->run('Hello!');
echo $response->text;
MistralProvider::MODEL_MISTRAL_LARGE // 'mistral-large-latest' (default)
MistralProvider::MODEL_MISTRAL_EMBED // 'mistral-embed' (embeddings)