-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path07-custom-labels.ts
More file actions
59 lines (55 loc) · 1.42 KB
/
07-custom-labels.ts
File metadata and controls
59 lines (55 loc) · 1.42 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
55
56
57
58
/**
* Example 7: Custom Labels
*
* This example shows how to use custom labels for components
* to create more structured and readable prompts.
*/
import { PromptBuilder } from '../dist';
const prompt = new PromptBuilder()
.role('You are a code review assistant', {
label: '🎭 ROLE'
})
.goal('Review code and provide constructive feedback', {
label: '🎯 GOAL'
})
.context('Codebase: ${codebase}\nLanguage: ${language}\nFramework: ${framework}', {
label: '📋 CONTEXT'
})
.input('Code to review:\n${code}', {
label: '📥 INPUT'
})
.tasks([
'Check for bugs',
'Review code style',
'Suggest improvements',
'Verify best practices'
], {
label: '✅ TASKS'
})
.constraints([
'Focus on code quality',
'Follow best practices',
'Consider performance',
'Ensure security'
], {
label: '⚠️ CONSTRAINTS'
})
.guardrails([
'Be constructive and respectful',
'Focus on the code, not the person',
'Provide actionable feedback'
], {
label: '🛡️ GUARDRAILS'
})
.output('Provide:\n- Summary of findings\n- Specific recommendations\n- Code examples if needed', {
label: '📤 OUTPUT'
})
.build({
codebase: 'TypeScript',
language: 'TypeScript',
framework: 'React',
code: 'function add(a: number, b: number) { return a + b; }'
});
console.log('=== Custom Labels Example ===');
console.log(prompt);
console.log('\n');