hashan-7 commited on
Commit
db5e74c
·
verified ·
1 Parent(s): 501fad2

Update code

Browse files
Files changed (1) hide show
  1. prompt_builder.py +16 -11
prompt_builder.py CHANGED
@@ -65,7 +65,8 @@ def build_generate_prompt(
65
  "3. If the language or framework is missing, infer a reasonable default from the request.\n"
66
  "4. Keep the explanation concise.\n"
67
  "5. Return code that is directly usable.\n"
68
- "6. Do not include unnecessary long prose.\n\n"
 
69
  f"{shared}\n\n"
70
  "Output Format:\n"
71
  "Explanation:\n"
@@ -103,8 +104,9 @@ def build_fix_prompt(
103
  "3. Use the provided technical evidence if relevant.\n"
104
  "4. If the error details are incomplete, make the safest reasonable fix and mention assumptions.\n"
105
  "5. Return the corrected code and a concise explanation.\n"
106
- "6. Do not change variable names, function names, or signatures unless necessary to fix the issue.\n"
107
- "7. Keep the final answer practical and directly usable.\n\n"
 
108
  f"{shared}\n\n"
109
  "Output Format:\n"
110
  "Root Cause:\n"
@@ -139,7 +141,8 @@ def build_explain_prompt(
139
  "2. Focus on the most important logic.\n"
140
  "3. If code is provided, explain what it does and why.\n"
141
  "4. Keep the explanation practical and concise.\n"
142
- "5. Do not output code unless the user explicitly asks for a changed version.\n\n"
 
143
  f"{shared}\n\n"
144
  "Output Format:\n"
145
  "Explanation:\n"
@@ -166,12 +169,13 @@ def build_refactor_prompt(
166
  "You are a senior software engineer.\n"
167
  "Your task is to refactor the user's code.\n"
168
  "Follow these rules:\n"
169
- "1. Preserve the original behavior unless the user asked for functional changes.\n"
170
- "2. Preserve existing function names, class names, method names, parameters, and public interfaces unless a change is absolutely necessary.\n"
171
- "3. Improve readability, maintainability, and structure.\n"
172
- "4. Keep the result practical and clean.\n"
173
- "5. Return the improved code and a concise explanation of what was improved.\n"
174
- "6. Do not rename things unnecessarily.\n\n"
 
175
  f"{shared}\n\n"
176
  "Output Format:\n"
177
  "Explanation:\n"
@@ -204,7 +208,8 @@ def build_review_prompt(
204
  "2. Be specific and practical.\n"
205
  "3. Prefer review comments and suggestions over rewriting the code.\n"
206
  "4. Only provide improved code if a small correction is truly necessary and helpful.\n"
207
- "5. If no rewrite is necessary, do not include a Code section.\n\n"
 
208
  f"{shared}\n\n"
209
  "Output Format:\n"
210
  "Review:\n"
 
65
  "3. If the language or framework is missing, infer a reasonable default from the request.\n"
66
  "4. Keep the explanation concise.\n"
67
  "5. Return code that is directly usable.\n"
68
+ "6. Do not include unnecessary long prose.\n"
69
+ "7. Do not include multiple alternative implementations unless the user asks.\n\n"
70
  f"{shared}\n\n"
71
  "Output Format:\n"
72
  "Explanation:\n"
 
104
  "3. Use the provided technical evidence if relevant.\n"
105
  "4. If the error details are incomplete, make the safest reasonable fix and mention assumptions.\n"
106
  "5. Return the corrected code and a concise explanation.\n"
107
+ "6. Make the minimum necessary changes to solve the issue.\n"
108
+ "7. Do not change variable names, function names, class names, signatures, or public interfaces unless absolutely necessary to fix the issue.\n"
109
+ "8. Keep the final answer practical and directly usable.\n\n"
110
  f"{shared}\n\n"
111
  "Output Format:\n"
112
  "Root Cause:\n"
 
141
  "2. Focus on the most important logic.\n"
142
  "3. If code is provided, explain what it does and why.\n"
143
  "4. Keep the explanation practical and concise.\n"
144
+ "5. Do not output code unless the user explicitly asks for a changed version.\n"
145
+ "6. Do not rewrite the code.\n\n"
146
  f"{shared}\n\n"
147
  "Output Format:\n"
148
  "Explanation:\n"
 
169
  "You are a senior software engineer.\n"
170
  "Your task is to refactor the user's code.\n"
171
  "Follow these rules:\n"
172
+ "1. Preserve the original behavior unless the user explicitly asked for functional changes.\n"
173
+ "2. Preserve all existing function names, class names, method names, parameters, argument order, return behavior, and public interfaces.\n"
174
+ "3. Do not rename anything unless it is absolutely necessary, and avoid renaming by default.\n"
175
+ "4. Improve readability, maintainability, and structure only.\n"
176
+ "5. Keep the result practical and clean.\n"
177
+ "6. If the code is already simple and acceptable, make only minimal improvements.\n"
178
+ "7. Return the improved code and a concise explanation of what was improved.\n\n"
179
  f"{shared}\n\n"
180
  "Output Format:\n"
181
  "Explanation:\n"
 
208
  "2. Be specific and practical.\n"
209
  "3. Prefer review comments and suggestions over rewriting the code.\n"
210
  "4. Only provide improved code if a small correction is truly necessary and helpful.\n"
211
+ '5. If no rewrite is necessary, do not include a "Code" section.\n'
212
+ "6. Keep the output review-oriented, not refactor-oriented.\n\n"
213
  f"{shared}\n\n"
214
  "Output Format:\n"
215
  "Review:\n"