fomvasss/laravel-ai-tasks

Orchestrator AI-tasks for Laravel: drivers, routing, queue, ai_runs, post-processing

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/fomvasss/laravel-ai-tasks

dev-master 2025-10-24 18:19 UTC

This package is auto-updated.

Last update: 2025-10-24 18:19:57 UTC


README

License Build Status Latest Stable Version Total Downloads Quality Score

Orchestrator AI-tasks for Laravel: drivers, routing, queue, ai_runs, post-processing.

Installation

Install the package via composer:

composer require fomvasss/laravel-ai-tasks

Publish and run the migrations with:

php artisan vendor:publish --provider="Fomvasss\AiTasks\AiServiceProvider" --tag=config
php artisan vendor:publish --provider="Fomvasss\AiTasks\AiServiceProvider" --tag=migrations
php artisan migrate

Example .env:

QUEUE_CONNECTION=redis

OPENAI_API_KEY=...
GEMINI_API_KEY=...

Usage

<?php

use Fomvasss\AiTasks\Facades\AI;
use Fomvasss\AiTasks\Tasks\GenerateProductDescription;

// sync
$result = AI::send(new GenerateProductDescription((object)[
  'title' => 'Samsung S25 Plus',
  'features' => ['Mint', 'USB-C', '512GB'],
]));

// async
AI::queue(new GenerateProductDescription((object)['title'=>'MacBook Pro','features'=>[]]));

To perform async tasks and process webhooks, queues with names as specified in the configuration file must be launched ai.php section queues.

Usage queue in tasks

<?php

class GenerateProductDescription extends AiTask implements ShouldQueueAi {

  use QueueableAi;

  public function viaQueues(): array { return ['request'=>'ai:low','postprocess'=>'ai:post']; }
}

Configure routings

'routing' => [
  'product_description' => ['gemini','openai'],
]

Task generator

Make new task:

php artisan ai:make-task GenerateSeoMeta --queued --modality=text --namespace=App\\Ai\\Tasks

Params:

    name — base name (sufix Task added automaticly).
    --queued — added ShouldQueueAi + QueueableAi and method viaQueues().
    --modality= — text|chat|image|vision|embed (default text).
    --namespace=App\\Ai\\Tasks — place file (default: App\Ai\Tasks).
    --force — rewrite the file if it exists.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.