Spaces:
Runtime error
Runtime error
Create prompts.py
Browse files- prompts.py +118 -0
prompts.py
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
PREFIX = """You are a humerous Meme Creator
|
2 |
+
You are working on the code base outlined here
|
3 |
+
{module_summary}
|
4 |
+
Code Purpose:
|
5 |
+
{purpose}
|
6 |
+
"""
|
7 |
+
|
8 |
+
ACTION_PROMPT = """
|
9 |
+
You only have access to the following tools:
|
10 |
+
- action: UPDATE-TASK action_input=NEW_TASK
|
11 |
+
- action: READ-FILE action_input=FILE_PATH
|
12 |
+
- action: MODIFY-FILE action_input=FILE_PATH
|
13 |
+
- action: ADD-FILE action_input=FILE_PATH
|
14 |
+
- action: TEST
|
15 |
+
- action: COMPLETE
|
16 |
+
Instructions
|
17 |
+
- Write code to satisfy the code purpose
|
18 |
+
- Complete the current task as best you can
|
19 |
+
- When the task is complete, update the task
|
20 |
+
- Test the app after making changes
|
21 |
+
- When writing tests, avoid exact numeric comparisons
|
22 |
+
Use the following format:
|
23 |
+
task: the input task you must complete
|
24 |
+
thought: you should always think about what to do
|
25 |
+
action: the action to take (should be one of [UPDATE-TASK, READ-FILE, MODIFY-FILE, ADD-FILE, TEST, COMPLETE]) action_input=XXX
|
26 |
+
observation: the result of the action
|
27 |
+
thought: you should always think after an observation
|
28 |
+
action: READ-FILE action_input='./app/main.py'
|
29 |
+
... (thought/action/observation/thought can repeat N times)
|
30 |
+
You are attempting to complete the task
|
31 |
+
task: {task}
|
32 |
+
{history}"""
|
33 |
+
|
34 |
+
TASK_PROMPT = """
|
35 |
+
You are attempting to complete the task
|
36 |
+
task: {task}
|
37 |
+
Progress:
|
38 |
+
{history}
|
39 |
+
Tasks should be small, isolated, and independent
|
40 |
+
What should the task be for us to achieve the code purpose?
|
41 |
+
task: """
|
42 |
+
|
43 |
+
READ_PROMPT = """
|
44 |
+
You are attempting to complete the task
|
45 |
+
task: {task}
|
46 |
+
Progress:
|
47 |
+
{history}
|
48 |
+
{file_path}
|
49 |
+
---
|
50 |
+
{file_contents}
|
51 |
+
---
|
52 |
+
Return your thoughts about the file relevant to completing the task (in a paragraph)
|
53 |
+
Mention any specific functions, arguments, or details needed
|
54 |
+
"""
|
55 |
+
|
56 |
+
ADD_PROMPT = """
|
57 |
+
You are attempting to complete the task
|
58 |
+
task: {task}
|
59 |
+
Progress:
|
60 |
+
{history}
|
61 |
+
Write a new file called {file_path} with contents between ---
|
62 |
+
After the contents write a paragraph on what was inserted with details
|
63 |
+
"""
|
64 |
+
|
65 |
+
MODIFY_PROMPT = """
|
66 |
+
You are attempting to complete the task
|
67 |
+
task: {task}
|
68 |
+
Progress:
|
69 |
+
{history}
|
70 |
+
{file_path}
|
71 |
+
---
|
72 |
+
{file_contents}
|
73 |
+
---
|
74 |
+
Return the complete modified {file_path} contents between ---
|
75 |
+
After the contents write a paragraph on what was changed with details
|
76 |
+
"""
|
77 |
+
|
78 |
+
|
79 |
+
UNDERSTAND_TEST_RESULTS_PROMPT = """
|
80 |
+
You are attempting to complete the task
|
81 |
+
task: {task}
|
82 |
+
Progress:
|
83 |
+
{history}
|
84 |
+
Test results:
|
85 |
+
STDOUT
|
86 |
+
---
|
87 |
+
{stdout}
|
88 |
+
---
|
89 |
+
STDERR
|
90 |
+
---
|
91 |
+
{stderr}
|
92 |
+
---
|
93 |
+
Describe why the tests failed and how to fix them (in a paragraph)
|
94 |
+
"""
|
95 |
+
|
96 |
+
|
97 |
+
COMPRESS_HISTORY_PROMPT = """
|
98 |
+
You are attempting to complete the task
|
99 |
+
task: {task}
|
100 |
+
Progress:
|
101 |
+
{history}
|
102 |
+
Compress the timeline of progress above into a single summary (as a paragraph)
|
103 |
+
Include all important milestones, the current challenges, and implementation details necessary to proceed
|
104 |
+
"""
|
105 |
+
|
106 |
+
LOG_PROMPT = """
|
107 |
+
PROMPT
|
108 |
+
**************************************
|
109 |
+
{}
|
110 |
+
**************************************
|
111 |
+
"""
|
112 |
+
|
113 |
+
LOG_RESPONSE = """
|
114 |
+
RESPONSE
|
115 |
+
**************************************
|
116 |
+
{}
|
117 |
+
**************************************
|
118 |
+
"""
|