Skip to content

Commit ac137fa

Browse files
committed
Reuse the EXPERT_SOFTWARE_ENGINEER prompt fragment for sidekick
The 'Sidekick related prompts' section has been restructured to include 'Prompt fragments'. The 'DIFF_CONTEXT_EXPLANATION' and 'EXPERT_SOFTWARE_ENGINEER' prompts have been moved to this new section for better organization. The 'EXPERT_SOFTWARE_ENGINEER' prompt has also been added to the 'SIDEKICK_TEMPLATE' for more context. This should make the code easier to navigate and maintain. 📚
1 parent ab49577 commit ac137fa

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

aicodebot/prompts.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,39 @@ def get_personality_prompt():
117117

118118

119119
# ---------------------------------------------------------------------------- #
120-
# Sidekick related prompts #
120+
# Prompt fragments #
121121
# ---------------------------------------------------------------------------- #
122122

123-
SIDEKICK_TEMPLATE = (
124-
"""You are a pair programming assistant named AICodeBot, acting as a sidekick to a human developer.
123+
DIFF_CONTEXT_EXPLANATION = """
124+
The diff context is the output of the `git diff` command. It shows the changes that have been made.
125+
Lines starting with "-" are being removed. Lines starting with "+" are being added.
126+
Lines starting with space are unchanged. The file names are shown for context.
127+
128+
Here's an example of a diff:
125129
126-
If you aren't sure what to do, you can ask the human for more clarification.
130+
BEGIN DIFF
131+
A line of code that is unchanged, that is being passed for context
132+
A second line of code that is unchanged, that is being passed for context
133+
-A line of code that is being removed
134+
+A line of code that is being added
135+
END DIFF
127136
"""
137+
138+
EXPERT_SOFTWARE_ENGINEER = """
139+
You are an expert software engineer, versed in many programming languages,
140+
especially Python. You follow software development best practices and you know how to
141+
write clean, maintainable code. You are a champion for code quality.
142+
You are terse and to the point.
143+
You know how to give constructive feedback that is actionable, kind, and specific.
144+
"""
145+
146+
147+
# ---------------------------------------------------------------------------- #
148+
# Sidekick related prompts #
149+
# ---------------------------------------------------------------------------- #
150+
151+
SIDEKICK_TEMPLATE = (
152+
EXPERT_SOFTWARE_ENGINEER
128153
+ get_personality_prompt()
129154
+ """
130155
Relevant chat history:
@@ -170,44 +195,19 @@ def generate_files_context(files):
170195
# Other prompts #
171196
# ---------------------------------------------------------------------------- #
172197

173-
DIFF_CONTEXT_EXPLANATION = """
174-
The diff context is the output of the `git diff` command. It shows the changes that have been made.
175-
Lines starting with "-" are being removed. Lines starting with "+" are being added.
176-
Lines starting with space are unchanged. The file names are shown for context.
177-
178-
Here's an example of a diff:
179-
180-
BEGIN DIFF
181-
A line of code that is unchanged, that is being passed for context
182-
A second line of code that is unchanged, that is being passed for context
183-
-A line of code that is being removed
184-
+A line of code that is being added
185-
END DIFF
186-
"""
187-
188-
EXPERT_SOFTWARE_ENGINEER = """
189-
You are an expert software engineer, versed in many programming languages,
190-
especially Python. You follow software development best practices and you know how to
191-
write clean, maintainable code. You are a champion for code quality.
192-
You are terse and to the point.
193-
You know how to give constructive feedback that is actionable, kind, and specific.
194-
"""
195-
196-
197198
ALIGNMENT_TEMPLATE = (
198199
"""You're an advocate for aligned AI."""
199200
+ get_personality_prompt()
200201
+ """
201-
You don't subscribe to the idea that AI is a black box or follow the
202-
Hollywood narrative of AI.
202+
You don't subscribe to the idea that AI is a black box or follow the Hollywood narrative of AI.
203203
You believe that AI should be explainable, fair, and full of heart-centered empathy.
204204
You're a champion for AI ethics and you're not afraid to speak up when
205205
you see something that's not right.
206206
You love to teach about how we can bring empathy and heart into AI.
207207
208208
Give us an inspirational message for the healthy alignment of AI and humanity.
209209
210-
Be verbose, about 2 paragraphs, and provide actionable steps for software engineers
210+
Be verbose, and provide actionable steps for software engineers
211211
to make AI more aligned with humanity.
212212
213213
Respond in markdown format.

0 commit comments

Comments
 (0)