The Prompt package for Laravel by @chimit provides a simple way to manage your AI prompts in Markdown files, leveraging the power of Blade. You define prompt templates in the resources/prompts folder, which might look like the following example:
You are an SEO expert specializing in e-commerce. Generate a compelling meta description for this product.
**Product:** {{ $product->name }}
**Price:** ${{ number_format($product->price, 2) }}
**Product Description:**
---
{!! $product->description !!}
---
@if($product->discount_percentage > 0)
**Special Offer:** {{ $product->discount_percentage }}% OFF - Limited Time!
@endif
Requirements:
- Maximum 160 characters
- Include the product name and key benefits
- Create urgency if there's a discount
- Target keywords: {{ implode(', ', $keywords) }}
You can render these templates using the package's Prompt class:
use Chimit\Prompt; $prompt = Prompt::get('seo/product-meta', [ 'product' => $product, 'keywords' => ['wireless headphones', 'bluetooth', 'noise canceling'] ]);
Currently, the package lacks configuration options or the ability to create a new template using an Artisan command; however, the concept behind it is an interesting approach to rendering a dynamic prompt using a tool like Blade.
👩💻 Get started with this package on GitHub: chimit/prompt