PHP code example of eloquage / laravel-prompt-renderer
1. Go to this page and download the library: Download eloquage/laravel-prompt-renderer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eloquage / laravel-prompt-renderer example snippets
use Eloquage\LaravelPromptRenderer\PromptRenderer;
use Laravel\Ai\Contracts\Agent;
use Laravel\Ai\Promptable;
class ReviewAgent implements Agent
{
use Promptable;
public function __construct(private PromptRenderer $prompts) {}
public function instructions(): string
{
return $this->prompts->render('example', [
'context' => 'case review',
]);
}
}
use Eloquage\LaravelPromptRenderer\Contracts\PromptSource;
use Eloquage\LaravelPromptRenderer\Managers\PromptSourceManager;
PromptSourceManager::extend('redis', fn (): PromptSource => new RedisPromptSource());