PHP code example of laravelailabs / file-assistant
1. Go to this page and download the library: Download laravelailabs/file-assistant 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/ */
laravelailabs / file-assistant example snippets
$dialog = FileAssistant::addFile('PATH_TO_YOUR_FILE')
->addFile('PATH_TO_YOUR_SECOND_FILE')
->initialize();
echo $dialog->prompt('What is this document about?')
$dialog = FileAssistant::setConversation(Conversation::find(1))
->setUser(Auth::user())
->initialize();
// grab the conversation and display the messages
/**
* @var \LaravelAILabs\FileAssistant\Models\Conversation $conversation
*/
$conversation = $dialog->getConversation();
foreach ($conversation->messages as $message) {
echo sprintf('%s: %s <br>', $message->role, $message->content);
}
echo $dialog->prompt('Where did we leave off?')