pdro-lucas/filament-ai-writer
A reusable Filament Action that adds AI-powered text generation to any form field, supporting Anthropic Claude, OpenAI, and Google Gemini. Configure an API key, attach the action to a field, and generate content via an interactive modal or silent mode using other form fields as context.
AiProvider contract with container rebinding, means the PM decision isn't "which vendor" at build time — it's "which vendor per environment," with a documented escape hatch for a custom provider (Azure OpenAI, Bedrock, self-hosted). That de-risks vendor lock-in and lets procurement negotiate later.beforeGenerate, globalBeforeGenerate, and the AiTextGenerated event are the load-bearing pieces for product decisions: credit-based metering, per-plan gating, free-tier caps, and usage analytics all hook here without forking the package. If the roadmap includes "charge for AI credits," this package already exposes the right seams.valueMap (enum/scalar targets), allowedValues (constrained arrays with server-side filtering of out-of-list values), expectArray, and normalizeArrayCase are exactly the knobs needed to decide "can we let AI populate this field, or does data hygiene forbid it?" The filtering of disallowed values before injection is the difference between a demo and something you'd put in front of an editor.Adopt when:
globalBeforeGenerate for permissions/plan gating and AiTextGenerated for credit debits are documented with working examples — genuinely the strongest part of the README.contextFields covers these cleanly.Look elsewhere, or build in-house, when:
retry_times/retry_sleep_ms, no moderation layer, no streaming, and no failover across providers on error.AI_WRITER_TIMEOUT (default 60s). If UX requires token-by-token rendering, this is the wrong tool.AI_WRITER_MAX_TOKENS and per-provider token settings exist, but there is no spend ceiling, no per-user budget enforcement in-package (only via your own beforeGenerate logic), and no cost estimation in the event payload — you get provider, model, result, not token counts or cost.Risk register to weigh explicitly: 9 stars and 0 dependents means near-zero production validation in the wild; the first release was late 2026 and it is still pre-1.0, so breaking changes are expected, not hypothetical; the changelog shows active bug-fixing (e.g., OpenAI's max_tokens → max_completion_tokens migration), which is reassuring for maintenance but confirms the provider APIs themselves are moving targets you inherit.
To executives — the one-paragraph version: "This is a small, MIT-licensed component that adds an 'AI write this for me' button to fields in our existing admin panel. The strategic value is not the button — it's that it lets us test an AI-assisted editing workflow in production for roughly the cost of a sprint, on a system we already run, with metering and permission hooks built in. We can measure actual editor time saved before committing to a larger AI investment. The trade-off is real: it's a pre-1.0 package from a single maintainer, so we should pilot it internally, budget a small amount of engineering to vendor a fork, and not put it in front of customers until it stabilizes."
To executives — the decision framing:
hintAction calls. The custom-provider binding means we are not coupled to any AI vendor.To engineering — the summary:
"Filament 4 Action, hintAction/suffixAction on any field. Two modes: interactive modal for creative fields, silent derivation from contextFields for slug/excerpt/category/tags. Provider layer is an AiProvider contract bound in the container — override it for Azure, Bedrock, or anything custom. Output shaping is handled: valueMap for selects, allowedValues + expectArray + normalizeArrayCase for tags, with out-of-list values filtered server-side before injection. Metering and authz go in beforeGenerate and globalBeforeGenerate; AiTextGenerated fires post-generation with user/field/provider/model/result for ledgering. Config is env-first with an optional publishable config; keys never land in the database.
Three things to plan around: (1) generation is synchronous with a 60s default timeout — no streaming, so keep prompts short and set expectations in the UI. (2) Prompts are inline strings on each action; if we exceed ~15 AI fields, we should introduce our own prompt registry rather than scatter them further. (3) Pre-1.0 with one maintainer — install via a path or VCS repository so we can patch quickly, pin the version, and add a smoke test around each wired field so an upstream change fails loudly rather than silently producing bad content in a form."
How can I help you explore Laravel packages today?