Download the PHP package laravel-neuro/core without Composer
On this page you can find all versions of the php package laravel-neuro/core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laravel-neuro/core
More information about laravel-neuro/core
Files in laravel-neuro/core
Package core
Short Description A powerful laravel framework for connecting to AI APIs such as OpenAI, Gemini, and Ollama, send prompts, collect responses, create agents and agent networks, and put them to work using easy to setup and highly customizable state machines.
License MIT
Informations about the package core
Welcome to LaravelNeuro
Join the discussion on the LaravelNeuro Discord Server!
This Laravel package enhances your PHP Laravel application by introducing two powerful features:
- Integrating AI APIs into your application code using Pipeline and Prompt Classes.
- Setting up and running complex state machines that network any number of generative AI agents and functions to automate tasks and content generation.
Installation
Features
Prebuilt Pipelines
LaravelNeuro ships with a pre-configured set of Pipelines for fast implementation, including:
- ElevenLabs Text to Speech
- Namespace:
LaravelNeuro\LaravelNeuro\Pipelines\ElevenLabs\AudioTTS
- Prompt Class:
LaravelNeuro\LaravelNeuro\Prompts\IVFSprompt
- Namespace:
- OpenAI
- ChatCompletion
- Namespace:
LaravelNeuro\LaravelNeuro\Pipelines\OpenAI\ChatCompletion
- Prompt Class:
LaravelNeuro\LaravelNeuro\Prompts\SUAprompt
- Namespace:
- DallE
- Namespace:
LaravelNeuro\LaravelNeuro\Pipelines\OpenAI\DallE
- Prompt Class:
LaravelNeuro\LaravelNeuro\Prompts\PNSQFprompt
- Namespace:
- AudioTTS
- Namespace:
LaravelNeuro\LaravelNeuro\Pipelines\OpenAI\AudioTTS
- Prompt Class:
LaravelNeuro\LaravelNeuro\Prompts\IVFSprompt
- Namespace:
- ChatCompletion
All pipelines extend the basic LaravelNeuro\LaravelNeuro\Pipeline
, which itself extends the ApiAdapter
Class, facilitating the transmission of prompts and reception of responses via Guzzle.
Enabling Pipelines
Enable the OpenAI and ElevenLabs pipelines by adding your API key to your Laravel application's .env
file:
Change the default models for each Pipeline by publishing the lneuro
configuration file if desired:
This is not strictly necessary. Even when using one of the prebuilt Pipelines, you can switch from the default model to any compatible model simply by calling the setModel
method on your Pipeline
object, passing the name of the model as a string parameter. Example:
Example Usage
Here's an example of using OpenAI's ChatCompletion in a Laravel script with a streaming response:
Output Methods
The OpenAi ChatCompletion Pipeline also allows for various output methods including text
, json
, array
, jsonStream
, and arrayStream
, whereas the basic Pipeline class ships with the more generic output
and stream
methods.
State Machines
LaravelNeuro State Machines, called Corporations, are simple to setup and can network AI APIs and scripts for complex tasks.
Setup
For LaravelNeuro state machines to work, migrate its Eloquent models with:
Creating a Voice Assistant
Example setup for a voice-to-voice chat assistant:
-
Create the Corporation folder and example setup file:
- Fill out the
setup.json
file with the necessary AI models (speech to text, text generation, text to speech).
//setup.json example
- Install and run your Corporation:
This setup does not require coding but offers hooks for custom logic injection.
Advanced Use-Cases
More detailed use-cases and documentation will be available on the separate documentation website soon.