PHPackages                             postare/filament-model-ai - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. postare/filament-model-ai

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

postare/filament-model-ai
=========================

Integrate artificial intelligence into FilamentPHP, leveraging your Eloquent Model data as knowledge.

v1.1.0(2y ago)196185[1 PRs](https://github.com/postare/filament-model-ai/pulls)MITPHPPHP ^8.1CI failing

Since Nov 25Pushed 6mo ago2 watchersCompare

[ Source](https://github.com/postare/filament-model-ai)[ Packagist](https://packagist.org/packages/postare/filament-model-ai)[ Docs](https://github.com/postare/filament-model-ai)[ GitHub Sponsors](https://github.com/postare)[ RSS](/packages/postare-filament-model-ai/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (15)Versions (6)Used By (0)

Filament ModelAI Plugin
=======================

[](#filament-modelai-plugin)

ModelAI is a plugin designed for [FilamentPHP](https://filamentphp.com/) that interfaces with OpenAI APIs. Its primary function is to use existing model data as context to formulate requests to OpenAI APIs. In practice, it allows users to select specific records from a data model, such as a list of real estate properties or e-commerce products, and use this information as a basis for generating intelligent content or responses through OpenAI's AI capabilities.

Examples of Use
---------------

[](#examples-of-use)

### Example 1: Real Estate Portal

[](#example-1-real-estate-portal)

In a real estate portal, ModelAI can utilize data from a 'Properties' model to create tailored marketing content. For instance, by selecting a specific property, the plugin can generate optimized social media posts or identify key property-related points, all based on the specific property's data.

### Example 2: Wine E-commerce

[](#example-2-wine-e-commerce)

In a wine e-commerce platform, the plugin could be configured to work with a 'Wine' model, containing details like variety, vintage, and tasting notes. Using this data, 'ModelAI' could generate engaging product descriptions, gastronomic pairing recommendations, or even educational content about wine culture, all while harnessing OpenAI's artificial intelligence to ensure high-quality and relevant content.

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

[](#installation)

You can easily install the package via Composer:

```
composer require postare/filament-model-ai
```

Once the package is installed, you need to add your OpenAI API Key to your `.env` file:

```
OPENAI_API_KEY=sk-...
```

To publish the configuration file, use the following command:

```
php artisan vendor:publish --tag="filament-model-ai-config"
```

Optionally, you can also publish the views:

```
php artisan vendor:publish --tag="filament-model-ai-views"
```

The published configuration file contains the following settings:

```
// Configuration for Postare/ModelAi
return [
    // OpenAI API Key
    'openai_api_key' => env('OPENAI_API_KEY', ''),

    // Default OpenAI Model (refer to https://platform.openai.com/docs/models)
    'default_openai_model' => 'gpt-3.5-turbo-1106',

    // Disable selecting OpenAI Model
    'disable_openai_model_selection' => false,

    // Slug for the Model AI page
    'slug' => 'model-ai',

    // Filament Navigation Group (refer to translation file for label or disable it)
    'use_navigation_group' => true,

    // Model Settings
    'eloquent_model' => \App\Models\User::class, // Laravel model to use
    'selected_columns' => [ // Selected columns from the model
        'name',
        'email',
    ],
    'field_label' => 'name', // Field to use as a label
    'field_id' => 'id', // Field to use as an ID

    // System Prompt
    'system_prompt' => 'You are a helpful assistant. Consider the data at the end of this message as context and answer the questions I will ask you later.',

    // Predefined Prompts (feel free to add, remove, or modify them)
    'predefined_prompts' => [
        [
            'name' => 'SEO', // Prompt name
            'prompt' => 'Generate a title and an SEO-oriented meta description based on the provided data.', // Prompt instruction
        ],
        [
            'name' => 'Facebook Post', // Prompt name
            'prompt' => 'Create a Facebook post, avoiding lists.', // Prompt instruction
        ],
    ],
];
```

Feel free to customize these settings to fit your specific use case. Enjoy using ModelAI with FilamentPHP!

Usage
-----

[](#usage)

In addition to a page in your Panel where you can select the desired element, the Model, and the Prompt, you can also use ModelAI elsewhere in your project.

```
$response = ModelAi::chat()

  // Optional: Override the default OpenAI model specified in the configuration file
  ->openai_model('gpt-4-1106-preview')

  // Optional
  ->system('your name is GeePeeTee, and you speak in a very 16th-century, very polished way.')

  // Optional, model to use:
  // params: model, id, selected_columns
  ->model(\App\Models\User::class, 1, ['name', 'email', 'email_verified_at'])

  // Mandatory, prompt to use:
  ->prompt("tell me about this user")

  // Mandatory, send the request
  ->send();

// Pray tell, thou hath sought to gain insight into the individual known by the appellation "Francesco". This gentle soul didst establish an entity of digital correspondence through "inerba@******.com", yet verily, the verification of such an electronic missive remains a quest unfulfilled.

$response = ModelAi::chat()
  ->prompt("make up your own dad joke")
  ->send();

// Why don't skeletons fight each other? They don't have the guts.
```

Features
--------

[](#features)

- OpenAI API Integration
- Customizable Models
- Customizable Prompts
- FilamentPHP Page

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance47

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.3% of commits — single point of failure

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 ~55 days

Total

3

Last Release

786d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c9951f7bf6251c81aceb7df0a295359cd0d2356543350c6a1a988d4b60f3f981?d=identicon)[inerba](/maintainers/inerba)

---

Top Contributors

[![inerba](https://avatars.githubusercontent.com/u/5882517?v=4)](https://github.com/inerba "inerba (12 commits)")[![nidjo17](https://avatars.githubusercontent.com/u/6123774?v=4)](https://github.com/nidjo17 "nidjo17 (1 commits)")

---

Tags

aifilament-pluginfilamentphplaravel-packageopenaipluginlaravelopenaifilamentphp

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/postare-filament-model-ai/health.svg)

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

###  Alternatives

[pboivin/filament-peek

Full-screen page preview modal for Filament

253319.6k12](/packages/pboivin-filament-peek)[dotswan/filament-map-picker

Easily pick and retrieve geo-coordinates using a map-based interface in your Filament applications.

124139.3k2](/packages/dotswan-filament-map-picker)[guava/calendar

Adds support for vkurko/calendar to Filament PHP.

298241.0k3](/packages/guava-calendar)[lara-zeus/popover

Zeus Popover is filamentphp component to show a Popover with custom content in tables and infolist

2968.2k3](/packages/lara-zeus-popover)[jibaymcs/filament-tour

Bring the power of DriverJs to your Filament panels and start a tour !

12247.8k](/packages/jibaymcs-filament-tour)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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