1. Go to this page and download the library: Download veeqtoh/prompt-deck 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/ */
veeqtoh / prompt-deck example snippets
use PromptPHP\Deck\Facades\Deck;
// Load the active version of a prompt.
$prompt = Deck::get('order-summary');
// Render a role with variables.
$prompt->system(['tone' => 'friendly', 'order' => $orderDetails]);
// "You are a friendly customer service agent. Summarise the following order..."
// Build a messages array ready for any chat-completion API.
$messages = $prompt->toMessages(['tone' => 'friendly', 'order' => $orderDetails]);
// [['role' => 'system', 'content' => '...']]
$prompt = Deck::get('order-summary', 'v2');
use PromptPHP\Deck\Concerns\HasPromptTemplate;
class OrderAgent extends Agent
{
use HasPromptTemplate;
// instructions() and promptMessages() are provided automatically.
}