Anomalous Blog - A LaravelNeuro Proof-of-Concept Application

LaravelNeuro is a Laravel package designed to allow for the integration of AI APIs into your application architecture. This includes a sophisticated state-machine system that can be used to create complex LaravelNeuro state-machines, networking AI agents, php scripts, and Eloquent Models.
The Anomalous Blog consists of blog articles that were generated by first crawling real news articles, then running them through a multi-tiered state machine to create short pieces of supernatural fiction, which are then "assessed" by a fictional paranormal intelligence agency, the "SCP Foundation". The blog is rendered using a Vue3 Frontend, plugged into the Laravel application using InertiaJS. Articles presented are drawn from the Database and linked to Eloquent models created by the "CreepyPastaMachine", the central LaravelNeuro state-machine around which the application is built.
If you would like to test this application and experiment with the CreepyPastaMachine state-machine, you need to fill out the following parameters in your .env file:
DB_CONNECTION=mysql
DB_HOST=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
OPENAI_API_KEY=
GNEWS_API_KEY=
You can procure API Keys on the Open AI Platform and genews.io (WARNING: OpenAI Models are not free-to-use but rather come with a per-1000-tokens price. For reference: When generating new articles on the original Anomalous Blog, the sum usage of all involved models costs approximately 25 cents per article at the moment.)
In principle, all OpenAI models used here can be replaced with different models, if you have the necessary access and they offer a curl-based API (for example, you could replace chat-completion models with Ollama-hosted models. To do this, you'd have to either build a custom pipeline using the basic pipeline or use the basic pipeline: LaravelNeuro\LaravelNeuro\Pipeline
you may also need to manipulate prompts using the preProcessPrompt
and postProcessPrompt
method overrides in your CreepyPastaMachine transitions (located in app/CreepyPastaMachine/Transitions
php artisan make:pipeline MyPipeline
and replacing the Pipeline namespace in the setup file with your custom pipeline's namespace, or you could use the BasicPipeline
Make sure to build the Vue frontend. You may have to adapt the vite-config to your application's specifications, especially if you want to run npm run dev
for development.
npm run build
php artisan lneuro:install CreepyPastaMachine
The CreepyPastaMachine is a LaravelNeuro state machine. It leverages various Function-Type Transitions as well as a number of Agent-Type Transitions. In a LaravelNeuro state-machine, a number of units are set up to contain certain types of related AI-Agents, which are defined within each unit. Then, Transitions are defined, showing through which functions and agents a given task passes.
This state-machine is located in the app/Corporations/CreepyPastaMachine
folder and has the APP\Corporation\CreepyPastaMachine
namespace.
The structure of the machine can be found and manipulated at (app/Corporations/CreepyPastaMachine/setup.json
):
php artisan lneuro:run CreepyPastaMachine start
This is what happens during a run of CreepyPastaMachine:
After the run, the new BlogArticle
and ScpWarning
models created in the Database are used by the AnomalousBlogController to render generated articles and assessments on the website.
"transitions": [
{
"type": "FUNCTION",
"transitionName": "NewsCrawler",
"transitionHandle": "NewsCrawler"
},
{
"type": "AGENT",
"transitionName": "Summarizer",
"transitionHandle": "Blog.Summarizer"
},
{
"type": "AGENT",
"transitionName": "Paranormalist",
"transitionHandle": "Blog.Paranormalist"
},
{
"type": "AGENT",
"transitionName": "Writer",
"transitionHandle": "Blog.Writer"
},
{
"type": "AGENT",
"transitionName": "BlogTranslator",
"transitionHandle": "Translator.Fulltext"
},
{
"type": "AGENT",
"transitionName": "Formatter",
"transitionHandle": "Blog.Formatter"
},
{
"type": "AGENT",
"transitionName": "Photographer",
"transitionHandle": "Blog.Photographer"
},
{
"type": "AGENT",
"transitionName": "Assessor",
"transitionHandle": "SCPfoundation.Assessor"
},
{
"type": "AGENT",
"transitionName": "Arbiter",
"transitionHandle": "SCPfoundation.Arbiter"
},
{
"type": "AGENT",
"transitionName": "AssessmentTranslator",
"transitionHandle": "Translator.Fulltext"
},
{
"type": "AGENT",
"transitionName": "BlogVO",
"transitionHandle": "Radio.Blogger"
},
{
"type": "AGENT",
"transitionName": "ScpVO",
"transitionHandle": "Radio.SCPclerk"
},
{
"type": "FUNCTION",
"transitionName": "Validator",
"transitionHandle": "Validator"
}
]