Documentation Index
Fetch the complete documentation index at: https://kawax.biz/llms.txt
Use this file to discover all available pages before exploring further.
Laravel AI SDK integration
- Experimental implementation
- Supports only text generation. Other features are not supported yet.
This is an opt-in feature that is enabled only when Laravel AI SDK is installed.
composer require laravel/ai
php artisan vendor:publish --provider="Laravel\Ai\AiServiceProvider"
Add configuration to config/ai.php.
// config/ai.php
'default' => 'copilot',
'providers' => [
'copilot' => [
'driver' => 'copilot',
'key' => '',
],
],
Usage with the agent() helper:
use function Laravel\Ai\agent;
$response = agent(
instructions: 'You are an expert at software development.',
)->prompt('Tell me about Laravel');
echo $response->text;
Streaming is also supported. Only TextDelta is implemented.
use Laravel\Ai\Streaming\Events\TextDelta;
use function Laravel\Ai\agent;
$stream = agent(
instructions: 'You are an expert at software development.',
)->stream('Tell me about Laravel');
foreach ($stream as $event) {
if ($event instanceof TextDelta) {
echo $event->delta;
}
}
You can also use the standard Laravel AI SDK approach with Agent classes, but only part of the features are supported.