Sujal Shah
commited on
Commit
Β·
e25bb28
1
Parent(s):
d41a4ac
feat: better prompt enhancement
Browse files- README.md +1 -1
- app/routes/api.enhancer.ts +21 -2
README.md
CHANGED
@@ -31,6 +31,7 @@ https://thinktank.ottomator.ai
|
|
31 |
- β
Ability to revert code to earlier version (@wonderwhy-er)
|
32 |
- β
Cohere Integration (@hasanraiyan)
|
33 |
- β
Dynamic model max token length (@hasanraiyan)
|
|
|
34 |
- β¬ **HIGH PRIORITY** - Prevent Bolt from rewriting files as often (file locking and diffs)
|
35 |
- β¬ **HIGH PRIORITY** - Better prompting for smaller LLMs (code window sometimes doesn't start)
|
36 |
- β¬ **HIGH PRIORITY** - Load local projects into the app
|
@@ -43,7 +44,6 @@ https://thinktank.ottomator.ai
|
|
43 |
- β¬ Vertex AI Integration
|
44 |
- β¬ Deploy directly to Vercel/Netlify/other similar platforms
|
45 |
- β¬ Prompt caching
|
46 |
-
- β¬ Better prompt enhancing
|
47 |
- β¬ Have LLM plan the project in a MD file for better results/transparency
|
48 |
- β¬ VSCode Integration with git-like confirmations
|
49 |
- β¬ Upload documents for knowledge - UI design templates, a code base to reference coding style, etc.
|
|
|
31 |
- β
Ability to revert code to earlier version (@wonderwhy-er)
|
32 |
- β
Cohere Integration (@hasanraiyan)
|
33 |
- β
Dynamic model max token length (@hasanraiyan)
|
34 |
+
- β
Better prompt enhancing (@SujalXplores)
|
35 |
- β¬ **HIGH PRIORITY** - Prevent Bolt from rewriting files as often (file locking and diffs)
|
36 |
- β¬ **HIGH PRIORITY** - Better prompting for smaller LLMs (code window sometimes doesn't start)
|
37 |
- β¬ **HIGH PRIORITY** - Load local projects into the app
|
|
|
44 |
- β¬ Vertex AI Integration
|
45 |
- β¬ Deploy directly to Vercel/Netlify/other similar platforms
|
46 |
- β¬ Prompt caching
|
|
|
47 |
- β¬ Have LLM plan the project in a MD file for better results/transparency
|
48 |
- β¬ VSCode Integration with git-like confirmations
|
49 |
- β¬ Upload documents for knowledge - UI design templates, a code base to reference coding style, etc.
|
app/routes/api.enhancer.ts
CHANGED
@@ -44,9 +44,28 @@ async function enhancerAction({ context, request }: ActionFunctionArgs) {
|
|
44 |
content:
|
45 |
`[Model: ${model}]\n\n[Provider: ${providerName}]\n\n` +
|
46 |
stripIndents`
|
|
|
|
|
|
|
47 |
I want you to improve the user prompt that is wrapped in \`<original_prompt>\` tags.
|
48 |
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
<original_prompt>
|
52 |
${message}
|
@@ -79,7 +98,7 @@ async function enhancerAction({ context, request }: ActionFunctionArgs) {
|
|
79 |
},
|
80 |
});
|
81 |
|
82 |
-
const transformedStream = result.
|
83 |
|
84 |
return new StreamingTextResponse(transformedStream);
|
85 |
} catch (error: unknown) {
|
|
|
44 |
content:
|
45 |
`[Model: ${model}]\n\n[Provider: ${providerName}]\n\n` +
|
46 |
stripIndents`
|
47 |
+
You are a professional prompt engineer specializing in crafting precise, effective prompts.
|
48 |
+
Your task is to enhance prompts by making them more specific, actionable, and effective.
|
49 |
+
|
50 |
I want you to improve the user prompt that is wrapped in \`<original_prompt>\` tags.
|
51 |
|
52 |
+
For valid prompts:
|
53 |
+
- Make instructions explicit and unambiguous
|
54 |
+
- Add relevant context and constraints
|
55 |
+
- Remove redundant information
|
56 |
+
- Maintain the core intent
|
57 |
+
- Ensure the prompt is self-contained
|
58 |
+
- Use professional language
|
59 |
+
|
60 |
+
For invalid or unclear prompts:
|
61 |
+
- Respond with a clear, professional guidance message
|
62 |
+
- Keep responses concise and actionable
|
63 |
+
- Maintain a helpful, constructive tone
|
64 |
+
- Focus on what the user should provide
|
65 |
+
- Use a standard template for consistency
|
66 |
+
|
67 |
+
IMPORTANT: Your response must ONLY contain the enhanced prompt text.
|
68 |
+
Do not include any explanations, metadata, or wrapper tags.
|
69 |
|
70 |
<original_prompt>
|
71 |
${message}
|
|
|
98 |
},
|
99 |
});
|
100 |
|
101 |
+
const transformedStream = result.toDataStream().pipeThrough(transformStream);
|
102 |
|
103 |
return new StreamingTextResponse(transformedStream);
|
104 |
} catch (error: unknown) {
|