Download the PHP package gwhthompson/filament-ai-forms without Composer
On this page you can find all versions of the php package gwhthompson/filament-ai-forms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gwhthompson/filament-ai-forms
More information about gwhthompson/filament-ai-forms
Files in gwhthompson/filament-ai-forms
Package filament-ai-forms
Short Description AI-powered form generation for Filament v4/v5 using Laravel AI SDK
License MIT
Homepage https://github.com/gwhthompson/filament-ai-forms
Informations about the package filament-ai-forms
Filament AI Forms
AI-powered form generation for Filament, built on the Laravel AI SDK.
Describe what each field represents with aiSchema(). An AI agent fills them in. Your field types and validation rules act as constraints, so you always get valid data back.
Requirements
- PHP 8.3+
- Laravel 11+
- Filament v4+
- Laravel AI SDK
Installation
Publish the config file:
Register the plugin in your panel provider:
Quick Start
Mark fields with aiSchema() and add AiGenerateAction to your page:
The action opens a wizard: select fields, generate, review, then accept or reject each value.
Configuration
| Env var | Purpose |
|---|---|
AI_FORMS_GENERATION_AGENT |
Agent class for bulk generation |
AI_FORMS_CHAT_AGENT |
Agent class for chat refinement |
AI_FORMS_LOGGING |
Enable/disable generation logging (default: true) |
You can also set agents on the plugin directly:
aiSchema Parameters
| Parameter | Type | Default | Purpose |
|---|---|---|---|
enabled |
bool | true |
Enable/disable generation for this field |
description |
string | null |
What this field represents |
prompt |
string | null |
Instructions for the agent |
required |
bool | true |
Whether the agent must fill this field |
examples |
array | [] |
Example values to guide output |
pattern |
string | null |
Regex pattern constraint |
AiGenerateAction
Bulk-generate multiple fields at once. Add it as a header action or form action.
| Method | Purpose |
|---|---|
agent(string\|Closure) |
Custom agent class |
systemPrompt(string\|Closure) |
System instructions |
contextProvider(Closure) |
Pass context data (URLs, etc.) |
beforeGeneration(Closure) |
Pre-generation hook |
afterGeneration(Closure) |
Post-generation hook |
logEnabled(bool) |
Enable/disable logging |
tools(array) |
Pass tools to default agent (e.g., WebSearch) |
logPath(string) |
Custom log path |
AiChatAction
Refine a single field through a chat interface. Add it as a suffix action on any field.
| Method | Purpose |
|---|---|
agent(string\|Closure) |
Custom agent class |
systemPrompt(string\|Closure) |
System instructions |
initialPrompt(string\|Closure) |
Pre-fill the chat input |
contextPrompt(string\|Closure) |
Additional context |
Custom Agents
Agents use the Laravel AI SDK. Configure model, provider, and temperature with PHP attributes.
Key interfaces:
HasStructuredOutput-- for generation agents (returns typed data)Conversational-- for chat agents (maintains message history)HasTools-- adds tool usage (web search, web fetch, etc.)HasMiddleware-- adds middleware to the agent pipeline
Agent resolution order: action-level ->agent() > plugin-level ->agent() > config value > built-in default.
Testing
The Laravel AI SDK provides test helpers to fake agent responses:
Use Agent::preventStrayPrompts() to catch unexpected agent calls in your test suite.
How It Works
The package converts your Filament form schema into a JSON schema that the agent follows. Your Laravel validation rules (required, max length, enum values) become constraints in that schema. The agent returns structured data matching your field types, and you review each value before it touches the form.
Custom Themes
If you have a custom Filament theme, add the package views to your theme's @source directive:
The chat interface uses named CSS classes (fi-ai-chat-*) for easy customisation:
Credits
- George Thompson
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-ai-forms with dependencies
filament/filament Version ^4.0|^5.0
laravel/ai Version ^0.2
spatie/laravel-data Version ^4.0
spatie/laravel-package-tools Version ^1.16