PHP code example of lenorix / laravel-ai-jobs

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

    

lenorix / laravel-ai-jobs example snippets


class MyGptJob extends GptChatJob implements ShouldQueue
{
    protected function getGptChatInstance(): GPTChat
    {
        return MyChatGPTChat::make(); // This helps the job to get an instance of your GPTChat.
    }
}

$trackerId = MyGptJob::dispatchWithTrack($myGptChat)
    ->getJob()
    ->tracker()
    ->id;

GptChatFuture::find($trackerId)
    ->getResultIn($myGptChat);
bash
php artisan vendor:publish --tag="job-status-migrations"
php artisan migrate