-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
52 lines (44 loc) · 1.71 KB
/
test.js
File metadata and controls
52 lines (44 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import dotenv from "dotenv";
import { PromptForgeClient } from "promptforge-server-sdk";
dotenv.config();
/**
* PROMPT FORGE STUDIO - GETTING STARTED
*
* 1. Initialize with your API Key and your Vercel URL.
* 2. Use a Version ID from your Studio History.
* 3. Provide variables matching your {{template_labels}}.
*
* To swap between Gemini and NVIDIA prompts, simply change the "Model" setting
* within your PromptForge Studio project for the specific version you are using.
* The SDK will automatically use the configured model.
*/
const client = new PromptForgeClient({
apiKey: process.env.PROMPTFORGE_API_KEY,
baseURL: "https://prompt-forge-studio.vercel.app" // 👈 ALWAYS update this to your live domain
});
async function run() {
console.log("🚀 Running PromptForge Execution...");
// Replace this with a Version ID from your PromptForge Studio project.
// You can find Version IDs in the "History" tab of your project.
const examplePromptId = "12a5af52-99a0-41dd-a5e9-8a318f23ddb5"; // Example: Simple Email template
try {
const result = await client.execute({
versionId: examplePromptId,
variables: {
customer_name: "Anil Suthar",
issue_type: "Database Sync Delay",
compensation_amount: "1,000 Free Credits"
}
});
if (result.success) {
console.log("✅ EXECUTION SUCCESS");
console.log("Output Content:\n", result.data);
console.log("\nMeta Specs:", result.meta);
} else {
console.log("❌ EXECUTION FAILED:", result.error);
}
} catch (err) {
console.error("🔥 SYSTEM ERROR:", err.message);
}
}
run();