Hello, thanks for the package!
I'm having this error when using the Facade : "A facade root has not been set".
This is part of my code :
<?php
namespace App\Services\AI;
use App\Services\AI;
use MoeMizrak\LaravelOpenrouter\Facades\LaravelOpenRouter;
use MoeMizrak\LaravelOpenrouter\DTO\ChatData;
use MoeMizrak\LaravelOpenrouter\DTO\MessageData;
use MoeMizrak\LaravelOpenrouter\Types\RoleType;
class OpenRouterEngine extends AI
{
public function executePrompt($prompt)
{
$model = 'mistralai/mistral-7b-instruct:free';
$messageData = new MessageData([
'content' => $prompt,
'role' => RoleType::USER,
]);
$chatData = new ChatData([
'messages' => [
$messageData,
],
'model' => $model,
'max_tokens' => 100, // Adjust this value as needed
]);
$chatResponse = LaravelOpenRouter::chatRequest($chatData);
return $chatResponse;
}
}
I've tried to add the Facade in the aliases, but still no luck:
The error occurs because the unit test is using PHPUnit\Framework\TestCase instead of Laravel's Tests\TestCase, which means Laravel's container and facades aren't initialized....
Hello, thanks for the package! I'm having this error when using the Facade : "A facade root has not been set".
This is part of my code :
I've tried to add the Facade in the aliases, but still no luck:
Sorry for the question, I'm quite new to Laravel, I'm probably doing something wrong...
Thanks for your help anyway