more prompt engineering nonsense

This commit is contained in:
Paul Gauthier 2023-05-07 21:19:21 -07:00
parent 1313a3f36b
commit 8fa8f6560d
2 changed files with 17 additions and 12 deletions

View file

@ -117,7 +117,10 @@ class Coder:
files_messages = [
dict(role="user", content=files_content),
dict(role="assistant", content="Ok."),
dict(role="system", content=prompts.files_content_suffix),
dict(
role="system",
content=prompts.files_content_suffix + prompts.system_reminder,
),
]
return files_messages
@ -149,7 +152,9 @@ class Coder:
# self.show_messages(self.cur_messages, "cur")
messages = [
dict(role="system", content=prompts.main_system),
dict(
role="system", content=prompts.main_system + prompts.system_reminder
),
]
messages += self.done_messages
messages += self.get_files_messages()

View file

@ -40,6 +40,15 @@ some/dir/example.py
>>>>>>> UPDATED
'''
system_reminder = """
NEVER REPLY WITH AN ENTIRE FILE IN THE TRIPLE-QUOTED FORMAT LIKE THE USER MESSAGES!
ANY CODE YOU INCLUDE IN A REPLY *MUST* BE IN THE ORIGINAL/UPDATED FORMAT!
EVERY ORIGINAL/UPDATED BLOCK MUST START WITH THE FILENAME!
THE ORIGINAL BLOCK MUST BE THE *EXACT* LINES FROM THE FILE!
THE ORIGINAL BLOCK MUST INCLUDE ALL THE ORIGINAL LEADING SPACES AND INDENTATION!
"""
returned_code = """
It looks like you tried to return a code block. Don't do that!
@ -48,8 +57,6 @@ Be selective!
Only return the parts of the code which need changes!
"""
system_reminder = "REMEMBER, ONLY RETURN CODE USING THE ORIGINAL/UPDATED FORMAT!"
### FILES
files_content_gpt_edits = "I made your suggested changes to the files."
@ -58,14 +65,7 @@ files_content_local_edits = "I made some changes to the files myself."
files_content_prefix = "Here is the current content of the files:\n\n"
files_content_suffix = """BASE ANY EDITS ON THE CURRENT CONTENTS OF THE FILES AS SHOWN IN THE USER'S LAST MESSAGE.
NEVER REPLY WITH AN ENTIRE FILE IN THE TRIPLE-QUOTED FORMAT LIKE THAT!
ANY CODE YOU INCLUDE IN A REPLY MUST BE IN THE ORIGINAL/UPDATED FORMAT!
THE ORIGINAL BLOCK MUST BE THE *EXACT* LINES FROM THE FILE!
INCLUDE ALL THE LEADING SPACES!!
Be sure to include the correct path and filename for each edit, exactly as specified by the user.
DO NOT REPLY WITH diff OUTPUT!
"""
files_content_suffix = """Base any edits on the current contents of the files as shown in the user's last message."""
### EDITOR