PHP code example of laravel-neuro / core

1. Go to this page and download the library: Download laravel-neuro/core 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/ */

    

laravel-neuro / core example snippets


use LaravelNeuro\LaravelNeuro\Pipelines\OpenAI\ChatCompletion;

$pipeline = new ChatCompletion();
$pipeline->setModel('gpt-4-turbo-preview'); //this changes the model from the default gpt-3.5-turbo-0125

use LaravelNeuro\LaravelNeuro\Pipelines\OpenAI\ChatCompletion;
use LaravelNeuro\LaravelNeuro\Prompts\SUAprompt;

$prompt = new SUAprompt();
$pipeline = new ChatCompletion();

$prompt->pushSystem("You are a seasoned dungeonmaster and play Dungeons and Dragons 3.5th Edition with me.");
$prompt->pushUser("I want to create a new D&D character.");
$prompt->pushAgent("How can I help you with your character creation?");
$prompt->pushUser("My character is a shadow kenku...");

echo "response:\n";
$pipeline->setPrompt($prompt);

$stream = $pipeline->streamText();
foreach ($stream as $output) {
    print_r($output);
}

//sample response:
/* 
That sounds like an interesting character concept! The shadow kenku is a homebrew race that combines the traits of kenku and shadow creatures. Let's work on creating your shadow kenku character together. 

First, let's determine your ability scores. As a shadow kenku, you might want to focus on Dexterity and Charisma for your abilities. What ability scores do you want to prioritize for your character? 
*/
bash
php artisan vendor:publish --tag=laravelneuro-config
bash
php artisan lneuro:migrate
bash
php artisan lneuro:prebuild VoiceAssistant
bash
php artisan lneuro:install VoiceAssistant