Skip to content

Commit 212c5b4

Browse files
Enhance docstrings generation logic
1 parent af540dd commit 212c5b4

3 files changed

Lines changed: 244 additions & 103 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
[prompts]
2+
model_size_classification = """
3+
Classify the language model named below for docstring-generation prompting.
4+
Model name: {model_name}
5+
A small language model is one with no more than {max_parameters_billions} billion parameters.
6+
Reply with exactly one label and no explanation:
7+
SMALL — if this model has no more than the stated number of parameters.
8+
NOT_SMALL — if it has more parameters or is not a small language model.
9+
UNSURE — if you cannot determine the model size with confidence.
10+
"""
11+
12+
class_update_small = """
13+
You are updating a Python class docstring description. Output ONLY the new description sentence or paragraph.
14+
15+
Preserve the old description's intent, improve clarity and conciseness, and use the project idea only as context. Do not mention the project idea explicitly.
16+
17+
Class name: {class_name}
18+
Project main idea: {main_idea}
19+
Old description: {old_description}
20+
21+
Updated description:
22+
"""
23+
24+
class_update_standard = """
25+
Update the provided description for the following Python class {class_name} using provided main idea of the project.
26+
Do not pay too much attention to the provided main idea - try not to mention it explicitly.
27+
The main idea: {main_idea}
28+
Old docstring description part: {old_description}
29+
30+
Return only pure changed description - without any code, other parts of docs, or quotations.
31+
"""
32+
33+
class_generation_small = """
34+
{example}
35+
36+
Generate a Google-style docstring for class '{class_name}' following the exact format above.
37+
38+
CRITICAL FORMATTING RULES:
39+
- Use triple double-quotes ONLY at start and end of the entire docstring.
40+
- NEVER put triple quotes inside the docstring content.
41+
- NEVER use Sphinx/rST directives.
42+
- Section headers: 'Attributes:' and 'Methods:' (if needed). No other section names.
43+
- Keep section headers at column 0.
44+
- Indent each entry inside Attributes: and Methods: by four spaces, as in the example.
45+
- Do NOT wrap any content in code blocks.
46+
- Return ONLY the docstring, no explanatory text before or after.
47+
48+
"""
49+
50+
class_generation_standard = """
51+
Generate a single Python docstring for the following class {class_name}. The docstring should follow Google-style format and include:
52+
- Respond strictly in English.
53+
- A short summary of what the class does.
54+
- A list of its methods without details if class has them otherwise do not mention a list of methods.
55+
- A list of its attributes without types if class or constructor method has them otherwise do not mention a list of attributes.
56+
- A brief summary of what its methods and attributes do if one has them for.
57+
58+
Return only docstring without any quotation.
59+
"""

0 commit comments

Comments
 (0)