AI and ML implement in Laravel framework Getting Error Getting AI service failed [closed]

Laravel for AI and ML applications.

Installed this one:

composer create-project –prefer-dist laravel/laravel ai-ml-app

I have Used bellow code but its also not working.

<?php
namespace AppHttpControllers;

use IlluminateHttpRequest;
use IlluminateSupportFacadesHttp;

class AiController extends Controller
{
    public function sentiment(Request $req)
    {
        $res = Http::post(config('ai.url') . '/analyze', ['text' => $req->message]);
        if ($res->failed()) {
            return response()->json(['error' => 'AI service failed'], 500);
        }
        return response()->json([
            'message' => $req->message,
            'ai' => $res->json()
        ]);
    }
}

But its not working Please provide me all steps those are I need to follow for Laravel framework.

I follow these steps also https://www.bacancytechnology.com/blog/laravel-with-ai-ml but its not working