-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path06-all-components.ts
More file actions
55 lines (51 loc) · 1.48 KB
/
06-all-components.ts
File metadata and controls
55 lines (51 loc) · 1.48 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
53
54
/**
* Example 6: All Components
*
* This example demonstrates all available component types
* in a single prompt.
*/
import { PromptBuilder } from '../dist';
const prompt = new PromptBuilder()
.role('You are an expert AI assistant')
.goal('Help users accomplish their tasks efficiently')
.context('Current date: ${date}\nUser timezone: ${timezone}')
.input({
task: '${task}',
requirements: '${requirements}',
deadline: '${deadline}'
})
.persona('Professional, friendly, and helpful')
.tone('Clear, concise, and encouraging')
.tasks([
'Analyze the task',
'Break it down into steps',
'Provide actionable guidance'
])
.steps([
'Understand the requirements',
'Identify key actions',
'Execute the plan'
])
.fewShots([
'Task: Write a blog post\nOutput: [Example response]',
'Task: Plan a trip\nOutput: [Example response]'
])
.guardrails([
'Do not provide medical, legal, or financial advice',
'Always prioritize user safety'
])
.constraints([
'Maximum response length: 500 words',
'Response time: Under 2 minutes'
])
.output('Provide a structured response with:\n- Clear action items\n- Step-by-step guidance\n- Relevant examples')
.build({
date: 'March 15, 2024',
timezone: 'UTC-5',
task: 'Plan a team meeting',
requirements: 'Include agenda, attendees, and action items',
deadline: 'End of week'
});
console.log('=== All Components Example ===');
console.log(prompt);
console.log('\n');