PHP code example of camaratech / laravel-ai-client

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

    

camaratech / laravel-ai-client example snippets


use CamaratechAi;

$result = CamaratechAi::generate([
    'prompt' => 'Gerar indicação legislativa...',
    'provider' => 'claude',
]);

if (! $result['success']) {
    logger()->error('Falha na IA', $result);
}

use Camaratech\AiClient\Services\CamaratechAiClient;

class GenerateIndication
{
    public function __construct(private CamaratechAiClient $ai) {}

    public function handle(): void
    {
        $response = $ai->generate([
            'prompt' => '...',
            'metadata' => ['context' => 'Indicação'],
        ]);
    }
}
bash
php artisan vendor:publish --tag=camaratech-ai-config