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
prompt=f"""Analyze the following {language} code block and generate a structured abstraction.
191
-
Your response should be in YAML format and include the following sections:
199
+
Your response should be in JSON format and include the following sections:
200
+
201
+
{{
202
+
"summary": "A concise one-sentence summary of the function's primary purpose.",
192
203
193
-
summary: A concise one-sentence summary of the function's primary purpose.
204
+
"functionality": "A detailed explanation of what the function does, including its main steps and logic. Use multiple lines if needed for clarity.",
194
205
195
-
functionality: |
196
-
A detailed explanation of what the function does, including its main steps and logic.
197
-
Use multiple lines if needed for clarity.
206
+
"inputs": [
207
+
{{
208
+
"name": "The parameter name",
209
+
"type": "The parameter type",
210
+
"description": "A brief description of the parameter's purpose",
211
+
"default_value": "The default value, if any (or null if not applicable)"
212
+
}}
213
+
],
198
214
199
-
inputs:
200
-
- name: The parameter name
201
-
type: The parameter type
202
-
description: A brief description of the parameter's purpose
203
-
default_value: The default value, if any (or null if not applicable)
215
+
"output": {{
216
+
"type": "The return type of the function",
217
+
"description": "A description of what is returned and under what conditions. Use multiple lines if needed."
218
+
}},
204
219
205
-
output:
206
-
type: The return type of the function
207
-
description: |
208
-
A description of what is returned and under what conditions.
209
-
Use multiple lines if needed.
220
+
"dependencies": [
221
+
{{
222
+
"name": "Name of the external library or module",
223
+
"purpose": "Brief explanation of its use in this function"
224
+
}}
225
+
],
210
226
211
-
dependencies:
212
-
- name: Name of the external library or module
213
-
purpose: Brief explanation of its use in this function
227
+
"algorithms": [
228
+
{{
229
+
"name": "Name of the algorithm or data structure",
230
+
"description": "Brief explanation of its use and importance"
231
+
}}
232
+
],
214
233
215
-
algorithms:
216
-
- name: Name of the algorithm or data structure
217
-
description: Brief explanation of its use and importance
234
+
"edge_cases": [
235
+
"A list of potential edge cases or special conditions the function handles or should handle"
236
+
],
218
237
219
-
edge_cases:
220
-
- A list of potential edge cases or special conditions the function handles or should handle
238
+
"error_handling": "A description of how errors are handled or propagated. Include specific error types if applicable.",
221
239
222
-
error_handling: |
223
-
A description of how errors are handled or propagated.
224
-
Include specific error types if applicable.
240
+
"usage_context": "A brief explanation of how this function might be used by parent functions or in a larger system. Include typical scenarios and any important considerations for its use.",
225
241
226
-
usage_context: |
227
-
A brief explanation of how this function might be used by parent functions or in a larger system.
228
-
Include typical scenarios and any important considerations for its use.
242
+
"complexity": {{
243
+
"time": "Estimated time complexity (e.g., O(n))",
244
+
"space": "Estimated space complexity (e.g., O(1))",
245
+
"explanation": "Brief explanation of the complexity analysis"
246
+
}},
229
247
230
-
complexity:
231
-
time: Estimated time complexity (e.g., O(n))
232
-
space: Estimated space complexity (e.g., O(1))
248
+
"tags": ["List", "of", "relevant", "tags"],
233
249
234
-
code_snippet: |
235
-
```{language}
236
-
{code_block}
237
-
```
250
+
"testing_considerations": "Suggestions for unit tests or test cases to cover key functionality and edge cases",
238
251
239
-
Provide your analysis in this clear, structured YAML format. If any section is not applicable, use an empty list [] or null value as appropriate. Ensure that multi-line descriptions are properly indented under their respective keys.
252
+
"version_compatibility": "Information about language versions or dependency versions this code is compatible with",
253
+
254
+
"performance_considerations": "Any notes on performance optimizations or potential bottlenecks",
255
+
256
+
"security_considerations": "Any security-related notes or best practices relevant to this code",
257
+
258
+
"maintainability_score": "A subjective score from 1-10 on how easy the code is to maintain, with a brief explanation"
259
+
}}
260
+
261
+
Provide your analysis in this clear, structured JSON format. If any section is not applicable, use an empty list [] or null value as appropriate. Ensure that multi-line descriptions are properly formatted as strings.
0 commit comments