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\Pipelines\OpenAI\ChatCompletion;
   use LaravelNeuro\Prompts\SUAprompt;

   $prompt = new SUAprompt();
   $prompt->pushSystem("You are a seasoned dungeonmaster for Dungeons and Dragons 3.5 Edition.");
   $prompt->pushUser("I want to create a new character.");
   $prompt->pushAgent("How can I help you?");
   $prompt->pushUser("My character is a shadow kenku...");

   $pipeline = new ChatCompletion();
   $pipeline->setModel('gpt-3.5-turbo'); // Change model if needed
   $pipeline->setPrompt($prompt);

   // For streaming responses:
   foreach ($pipeline->streamText() as $chunk) {
       echo $chunk;
   }

   // For non-stream output:
   echo $pipeline->output();
   
bash
php artisan vendor:publish --tag=laravelneuro-config
bash
   php artisan lneuro:prebuild VoiceAssistant
   
bash
   php artisan lneuro:install VoiceAssistant