1. Go to this page and download the library: Download maximerenou/pi-chat 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/ */
maximerenou / pi-chat example snippets
use MaximeRenou\PiChat\Client as PiChat;
use MaximeRenou\PiChat\Prompt;
$chatbot = new PiChat();
$conversation = $chatbot->createConversation();
// $answer - full answer
$answer = $conversation->ask(new Prompt("Hello World"));
// $current_answer - incomplete answer
// $tokens - last tokens received
$final_answer = $conversation->ask($prompt, function ($current_answer, $tokens) {
echo $tokens;
});
// Get current identifiers
$identifiers = $conversation->getIdentifiers();
// ...
// Resume conversation with $identifiers parameter
$conversation = $chatbot->resumeConversation($identifiers);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.