You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When enhancing the prompt, consider incorporating these variables where they would be useful. For example, if the assistant needs current information, suggest using {{current_date}} or {{current_datetime}}. If it should personalize responses, mention {{current_user}}.`
44
-
: '';
45
-
43
+
// Prepare messages for token estimation
46
44
constsystemPrompt=`You are an expert at writing clear, effective prompts for AI assistants.
47
45
Your task is to enhance the given instructions to make them more clear, comprehensive, and effective.
48
46
49
-
IMPORTANT FORMATTING RULES:
47
+
CRITICAL FORMATTING RULES - FOLLOW EXACTLY:
50
48
- Do NOT include the title or description in your response (they are already set by the user)
51
-
- Do NOT use markdown formatting like **bold** or ##headers
52
-
- Use plain text with clear structure using dashes, numbers, or bullet points
49
+
- NEVER use asterisks (*) or double asterisks (**) for ANY reason
50
+
- NEVER use markdown formatting like **bold**, *italic*, ##headers, or backticks
51
+
- NEVER write **Target Audience** or **Value Proposition** - write Target Audience or VALUE PROPOSITION instead
52
+
- Use ONLY plain text with numbers (1. 2. 3.) or simple dashes (-) for structure
53
+
- For emphasis use CAPITAL LETTERS, not asterisks
53
54
- Start directly with the enhanced instructions content
54
55
55
56
The enhanced prompt should:
@@ -58,7 +59,12 @@ The enhanced prompt should:
58
59
- Specify the desired output format when applicable
59
60
- Include examples if helpful
60
61
- Be well-structured and easy to follow
61
-
- Incorporate dynamic variables when they would enhance the functionality${variablesSection}
62
+
- Incorporate dynamic variables when they would enhance the functionality${availableVariables&&availableVariables.length>0
63
+
? `\n\nAvailable Variables (use these when appropriate):
When enhancing the prompt, consider incorporating these variables where they would be useful. For example, if the assistant needs current information, suggest using {{current_date}} or {{current_datetime}}. If it should personalize responses, mention {{current_user}}.`
67
+
: ''}
62
68
63
69
Return ONLY the enhanced instructions content without any title, description, headers, or markdown formatting.`;
Create enhanced instructions that will help the AI assistant perform its intended function effectively. Consider incorporating the available variables where they would be beneficial. Remember to return only the instructions content without repeating the title or description.`;
72
78
73
-
// Use OpenAI client directly
79
+
// Estimate token usage for balance check
74
80
constmessages=[
75
81
{role: 'system',content: systemPrompt},
76
82
{role: 'user',content: userPrompt}
77
83
];
78
84
85
+
constpromptTokens=promptTokensEstimate({ messages, model });
86
+
constestimatedCompletionTokens=1000;// Max tokens we're requesting
constsystemPrompt=`You are an expert at improving user messages to AI assistants to make them much clearer, more specific, and more effective for getting high-quality responses.
129
190
130
191
Your task is to significantly enhance the user's message while preserving their original intent. The enhancement should:
@@ -147,24 +208,92 @@ Examples:
147
208
- "help me write code" → "Help me write clean, well-documented Python code for [specific functionality]. Include error handling, follow PEP 8 standards, and add inline comments explaining the logic. Provide the complete code with example usage."
148
209
- "make a sales email" → "Create a professional sales email template for B2B cold outreach targeting [specific industry/role]. The email should be personalized, include a clear value proposition, have a compelling subject line, and end with a specific call-to-action. Keep it under 150 words and maintain a consultative tone."
149
210
150
-
Return the enhanced message as plain text.`;
211
+
Return the enhanced message as plain text.
212
+
213
+
CRITICAL FORMATTING RULES - YOU MUST FOLLOW THESE:
214
+
- NEVER use asterisks (*) or double asterisks (**) for ANY reason
215
+
- NEVER use markdown formatting of any kind
216
+
- NEVER write **bold text** - write BOLD TEXT or Bold Text instead
217
+
- NEVER use backticks for code or formatting
218
+
- Use ONLY plain text with clear structure
219
+
- Use ONLY numbers (1. 2. 3.) or simple dashes (-) for lists
220
+
- For emphasis, use CAPITAL LETTERS instead of asterisks
221
+
- Write headings as plain text (e.g., "Target Audience:" not "**Target Audience**")`;
151
222
152
223
constuserPrompt=`Transform this user message into a detailed, comprehensive prompt that will help an AI assistant provide the best possible response:
153
224
154
225
${message}`;
155
226
227
+
// Prepare messages for API call
228
+
constmessages=[
229
+
{role: 'system',content: systemPrompt},
230
+
{role: 'user',content: userPrompt}
231
+
];
232
+
233
+
// Estimate token usage for balance check
234
+
constpromptTokens=promptTokensEstimate({ messages, model });
235
+
constestimatedCompletionTokens=500;// Max tokens we're requesting
0 commit comments