PHP code example of anselmokossa / filament-chatai
1. Go to this page and download the library: Download anselmokossa/filament-chatai 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/ */
use Filament\ChatAi\ChatAiPlugin;
use Filament\ChatAi\Tools\LaravelMcpToolProvider;
$panel->plugins([
ChatAiPlugin::make()
->label('Assistant')
->systemPrompt('This is the Maputo store. Prices are in MZN.')
->tools(fn () => new LaravelMcpToolProvider([ // your laravel/mcp tools
\App\Mcp\Tools\SalesStatsTool::class,
]))
->canAccess(fn ($user) => $user->can('use-assistant'))
->canManageSettings(fn ($user) => $user->is_admin),
]);
ChatAiPlugin::make()
->readScreen() // false: only the URL and the record id are sent
->fillForms(false) // read the screen, but never touch the form
->navigate(false); // never change the page
#[Name('adjust-stock')]
#[Title('Adjust stock')]
class AdjustStockTool extends Tool // no #[IsReadOnly]: needs confirmation
{
public function schema(JsonSchema $schema): array
{
return [
'product' => $schema->string()->title('Product')->