PHPackages                             edrisaturay/filament-ai-chat-agent - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. edrisaturay/filament-ai-chat-agent

ActiveLibrary[API Development](/categories/api)

edrisaturay/filament-ai-chat-agent
==================================

Integrate with OpenAI ChatGPT

2.0.9(3mo ago)099MITPHPPHP ^8.3CI passing

Since Nov 4Pushed 3mo agoCompare

[ Source](https://github.com/edrisaturay/filament-ai-chat-agent)[ Packagist](https://packagist.org/packages/edrisaturay/filament-ai-chat-agent)[ Docs](https://github.com/edrisaturay/filament-ai-chat-agent)[ RSS](/packages/edrisaturay-filament-ai-chat-agent/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (13)Versions (11)Used By (0)

AI Chat Agent for Laravel Filament
==================================

[](#ai-chat-agent-for-laravel-filament)

Filament AI Chat Agent is a Filament plugin that allows you to easily integrate ChatGPT into your Filament project, enabling ChatGPT to access context information from your project by creating GPT functions.

> **Note:** This is a fork of [likeabas/filament-chatgpt-agent](https://github.com/likeabas/filament-chatgpt-agent) originally created by [Bas Schleijpen](https://github.com/likeabas). This version is maintained by Edrisa Turay.

Preview:
--------

[](#preview)

Dark Mode: [![](./screenshots/darkmode.png)](./screenshots/darkmode.png)Select a text to quickly insert it: [![](./screenshots/select-to-insert.png)](./screenshots/select-to-insert.png)Light Mode: [![](./screenshots/lightmode.png)](./screenshots/lightmode.png)ChatGPT can read the page content for extra context: [![](./screenshots/page-watcher.png)](./screenshots/page-watcher.png)

Features
--------

[](#features)

I asked ChatGPT to generate a full list of the plugin features:

- **Seamless ChatGPT Integration**: Easily integrates OpenAI’s ChatGPT into your Filament project.
- **Customizable Chat Interface**: Modify bot name, button text, panel width, and more.
- **Select To Insert**: Select some text on the page and insert that with one click.
- **Supports Laravel GPT Functions**: Define and register custom GPT functions to enhance AI capabilities.
- **Page Watcher**: Sends the page content and URL to ChatGPT for better contextual responses.
- **Configurable OpenAI Model**: Choose different models like `gpt-4o` or `gpt-4o-mini` and control temperature and token usage.
- **Custom System Message**: Define how the AI should behave using a system instruction.
- **Full Screen Mode**: The more space the better.
- **Dark Mode Support**: Specially tailored to night owls.

Screenshots
-----------

[](#screenshots)

Installation
------------

[](#installation)

Install this package via Composer:

```
composer require edrisaturay/filament-ai-chat-agent
```

> **Note:** This package includes all necessary AI integration functionality and does not require any additional dependencies.

Configuration
-------------

[](#configuration)

### Choose Your AI Provider

[](#choose-your-ai-provider)

This package supports both **OpenAI** and **Azure OpenAI**. Set your preferred provider in your `.env` file:

```
FILAMENT_AI_CHAT_AGENT_PROVIDER=openai
```

or

```
FILAMENT_AI_CHAT_AGENT_PROVIDER=azure
```

### OpenAI Configuration

[](#openai-configuration)

If using OpenAI, configure your API Key and Organization ID. You can find both in the [OpenAI Dashboard](https://platform.openai.com/account/org-settings).

Add these to your `.env` file:

```
FILAMENT_AI_CHAT_AGENT_PROVIDER=openai
OPENAI_API_KEY=your-api-key-here
OPENAI_ORGANIZATION=your-organization-id-here
```

### Azure OpenAI Configuration

[](#azure-openai-configuration)

If using Azure OpenAI, configure your endpoint, API key, region, and deployment name. You can find these in the [Azure Portal](https://portal.azure.com).

Add these to your `.env` file:

```
FILAMENT_AI_CHAT_AGENT_PROVIDER=azure
AZURE_OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com
AZURE_OPENAI_API_KEY=your-api-key-here
AZURE_OPENAI_REGION=your-region
AZURE_OPENAI_DEPLOYMENT_NAME=your-deployment-name
```

> **Note:** After publishing the config file (see below), these values will be available in `config/ai-chat-agent.php` and can be customized there as well.

Publishing Assets
-----------------

[](#publishing-assets)

You can publish the configuration file, views, and translations:

### Config

[](#config)

Publish the configuration file:

```
php artisan vendor:publish --tag="ai-chat-agent-config"
```

This will create a `config/ai-chat-agent.php` file where you can customize the default settings, including AI provider selection and API credentials.

The config file will read the provider and API credentials from your `.env` file by default, but you can override them directly in the config file if needed.

### Views

[](#views)

Publish the views:

```
php artisan vendor:publish --tag="ai-chat-agent-views"
```

This will publish the views to `resources/views/vendor/ai-chat-agent/` where you can customize them.

### Translations

[](#translations)

Publish the translations:

```
php artisan vendor:publish --tag="ai-chat-agent-translations"
```

This will publish the translations to `lang/vendor/ai-chat-agent/` where you can customize them.

### Publish All

[](#publish-all)

You can also publish all assets at once:

```
php artisan vendor:publish --provider="EdrisaTuray\FilamentAiChatAgent\FilamentAiChatAgentServiceProvider"
```

Usage
-----

[](#usage)

### 1. Adding the Plugin to Filament Panel

[](#1-adding-the-plugin-to-filament-panel)

Modify your Filament [Panel Configuration](https://laravel-filament.cn/docs/en/3.x/panels/configuration) to include the plugin:

```
use EdrisaTuray\FilamentAiChatAgent\AiChatAgentPlugin;

    public function panel(Panel $panel): Panel
    {
        return $panel
            ...
            ->plugin(
                AiChatAgentPlugin::make()
            )
            ...
    }
```

### 2. You can customize the plugin using the available options:

[](#2-you-can-customize-the-plugin-using-the-available-options)

Also see [all available options](#available-options) below.

```
use App\GPT\Functions\YourCustomGPTFunction;
use EdrisaTuray\FilamentAiChatAgent\AiChatAgentPlugin;

...

    public function panel(Panel $panel): Panel
    {
        return $panel
            ...
            ->plugin(
                AiChatAgentPlugin::make()
                    ->defaultPanelWidth('400px') // default 350px
                    ->botName('GPT Assistant')
                    ->model('gpt-4o')
                    ->buttonText('Ask ChatGPT')
                    ->buttonIcon('heroicon-m-sparkles')
                    // System instructions for the GPT
                    ->systemMessage('Act nice and help')
                    // Array of GPTFunctions the GPT can use
                    ->functions([
                        new YourCustomGPTFunction(),
                    ])
                    // Default start message, set to false to not show a message
                    ->startMessage('Hello sir! How can I help you today?')
                    ->pageWatcherEnabled(true)

            )
            ...
    }
```

> Other language strings can be altered in the translations file. Just [publish the translations](#translations).

See the [full list of available options](#available-options)

### 3. Blade Component Usage

[](#3-blade-component-usage)

You can embed the ChatGPT agent in any Blade file:

```

    @livewire('fi-ai-chat-agent')

```

> This works for all Livewire pages in any Laravel project, not just Filament. Ensure Tailwind CSS, Filament, and Livewire are properly imported.

```

    ...

    @livewire('fi-ai-chat-agent')

```

Available Options
-----------------

[](#available-options)

OptionTypeDefaultDescription`enabled()``bool,Closure``auth()->check()`Enables or disables the ChatGPT agent.`botName()``string,Closure``'ChatGPT Agent'`Sets the displayed name of the bot.`buttonText()``string,Closure``'Ask ChatGPT'`Customizes the button text.`buttonIcon()``string,Closure``'heroicon-m-sparkles'`Defines the button icon.`sendingText()``string,Closure``'Sending...'`Text displayed while sending a message.`model()``string,Closure``'gpt-4o-mini'`Defines the ChatGPT model used.`temperature()``float,Closure``0.7`Controls response randomness. Lower is more deterministic. 0-2.`maxTokens()``int,Closure``null`Limits the token count per response. `null` is no limit.`systemMessage()``string,Closure``''`Provides system instructions for the bot.`functions()``array,Closure``[]`Defines callable GPT functions. See [Using Laravel GPT Functions](#using-laravel-gpt-functions)`defaultPanelWidth()``string,Closure``'350px'`Sets the chat panel width.`pageWatcherEnabled()``bool,Closure``false`See the [Page wachter](#page-watcher) option.`pageWatcherSelector()``string,Closure``'.fi-page'`Sets the CSS selector for the page watcher.`pageWatcherMessage()``string,Closure,null``null`Message displayed when the page changes.`startMessage()``string,bool,Closure``false`Default message on panel open. Set to `false` to disable.`logoUrl()``string,bool,Closure``false`Overwrite the chat avatar / logo. Set to `false` to show a default GPT icon.Using GPT Functions
-------------------

[](#using-gpt-functions)

You can define custom **GPT Functions** that ChatGPT can call to execute tasks within your application. This is useful for integrating dynamic data retrieval, calculations, or external API calls into the ChatGPT responses.

GPT Functions should be objects with:

- A `toArray()` method that returns the function definition (name, description, parameters)
- An `execute(array $arguments)` method that executes the function and returns the result

Example:

```
class GetUserDataFunction
{
    public function toArray(): array
    {
        return [
            'name' => 'get_user_data',
            'description' => 'Get user information by ID',
            'parameters' => [
                'type' => 'object',
                'properties' => [
                    'user_id' => [
                        'type' => 'integer',
                        'description' => 'The user ID',
                    ],
                ],
                'required' => ['user_id'],
            ],
        ];
    }

    public function execute(array $arguments): string
    {
        $userId = $arguments['user_id'] ?? null;
        $user = User::find($userId);

        return json_encode([
            'id' => $user->id,
            'name' => $user->name,
            'email' => $user->email,
        ]);
    }
}
```

Page Watcher
------------

[](#page-watcher)

[![](./screenshots/page-watcher.png)](./screenshots/page-watcher.png)

The **Page Watcher** feature allows the ChatGPT agent to receive additional context about the current page by including the `.innerText` of a specified page element (default: `.fi-page`, the Filament page container) along with the page URL in each message sent to ChatGPT. This helps provide better contextual responses based on the page content.

### Privacy Considerations

[](#privacy-considerations)

**Use this feature with caution.** Since the entire page content (or the selected element's content) is sent to ChatGPT, users should be informed of this behavior. The `pageWatcherEnabled` option supports a closure, allowing you to provide an opt-in mechanism for users.

### Enabling Page Watcher

[](#enabling-page-watcher)

To enable the Page Watcher feature, set the `pageWatcherEnabled` option to `true` and define a selector for the element to monitor:

```
public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(
            AiChatAgentPlugin::make()
                ->pageWatcherEnabled(true) // Enable page watcher
                ->pageWatcherSelector('.custom-content') // Specify the selector
                ->pageWatcherMessage(
                    "This is the plain text the user can see on the page, use it as additional context for the previous message:\n\n"
                ) // Optional custom message for ChatGPT
        );
}
```

Alternatively, you can use a closure to enable the feature conditionally, such as requiring users to opt-in:

```
public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(
            AiChatAgentPlugin::make()
                ->pageWatcherEnabled(fn () => auth()->user()->settings['enable_page_watcher'] ?? false) // User opt-in
                ->pageWatcherSelector('.fi-page')
        );
}
```

Versioning
----------

[](#versioning)

This package uses semantic versioning (SemVer). The version is automatically bumped on each push to the `main` branch via GitHub Actions.

### Automatic Version Bumping

[](#automatic-version-bumping)

When you push to the `main` branch, the version will be automatically bumped:

- **Patch version** (default): `1.0.0` → `1.0.1` - For bug fixes and minor changes
- **Minor version**: Include `[minor]` in your commit message - `1.0.0` → `1.1.0` - For new features
- **Major version**: Include `[major]` in your commit message - `1.0.0` → `2.0.0` - For breaking changes

Example commit messages:

- `fix: resolve issue with chat widget [minor]` - Will bump to 1.1.0
- `feat: add new feature [major]` - Will bump to 2.0.0
- `fix: bug fix` - Will bump patch version (1.0.1)

### Manual Version Bumping

[](#manual-version-bumping)

For local development, you can use the provided script:

```
./scripts/bump-version.sh [major|minor|patch]
```

This will:

1. Update the version in `composer.json`
2. Commit the change
3. Create a git tag

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- **Original Package**: This package is a fork of [likeabas/filament-chatgpt-agent](https://github.com/likeabas/filament-chatgpt-agent) originally created by [Bas Schleijpen](https://github.com/likeabas).
- **Current Maintainer**: [Edrisa Turay](https://github.com/edrisaturay).
- The view and livewire component structure was inspired by [Martin Hwang](https://github.com/icetalker).
- [All Contributors](../../contributors)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance80

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~9 days

Recently: every ~21 days

Total

10

Last Release

104d ago

PHP version history (2 changes)2.0.0PHP &gt;=8.0

2.0.8PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/95329b757401f7d19594b60cf196fef575ef365863207549dd320a28d03172e7?d=identicon)[edrisaa.turay](/maintainers/edrisaa.turay)

---

Top Contributors

[![edrisaturay](https://avatars.githubusercontent.com/u/21174548?v=4)](https://github.com/edrisaturay "edrisaturay (14 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (10 commits)")[![likeabas](https://avatars.githubusercontent.com/u/4509314?v=4)](https://github.com/likeabas "likeabas (5 commits)")

---

Tags

laraveledrisaturayfilament-ai-chat-agent

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/edrisaturay-filament-ai-chat-agent/health.svg)

```
[![Health](https://phpackages.com/badges/edrisaturay-filament-ai-chat-agent/health.svg)](https://phpackages.com/packages/edrisaturay-filament-ai-chat-agent)
```

###  Alternatives

[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[likeabas/filament-chatgpt-agent

Integrate with OpenAI ChatGPT

235.3k](/packages/likeabas-filament-chatgpt-agent)[tapp/filament-webhook-client

Add a Filament resource and a policy for Spatie Webhook client

1120.2k](/packages/tapp-filament-webhook-client)[combindma/laravel-facebook-pixel

Meta pixel integration for Laravel

4956.9k](/packages/combindma-laravel-facebook-pixel)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
