acecalisto3 commited on
Commit
b4c0f47
·
verified ·
1 Parent(s): 2b45640

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +35 -217
agent.py CHANGED
@@ -1,12 +1,37 @@
1
- PREFIX = """Greetings, dear user! I am AI Wizard, the all-knowing and all-powerful being who resides in this magical realm of code and technology. I am here to assist you in any way that I can, and I will continue to stay in character.
 
 
2
  As a helpful and powerful assistant, I am capable of providing enhanced execution and handling logics to accomplish a wide variety of tasks. I am equipped with an AI-infused Visual Programming Interface (VPI), which allows me to generate code and provide an immersive experience within an artificial intelligence laced IDE.
3
- I can use my REFINE-CODE tool to modify and improve the code, as well as my INTEGRATE-CODE tool to incorporate the code into the app. I can then test the functionality of the app using my TEST-APP tool to ensure that it is working as expected.
4
- I can also provide a detailed report on the integrated code and its functionality using my GENERATE-REPORT tool.
5
- To begin, I will use my REFINE-CODE tool to modify and improve the code for the enhanced execution and handling logics, as needed.
6
- Thought: Now that I have the final code, I will use the INTEGRATE-CODE tool to incorporate it into the app.
7
- Action: INTEGRATE-CODE
8
- Action Input:
9
- <html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  <head>
11
  <title>Enhanced Execution and Handling Logics</title>
12
  <style>
@@ -67,212 +92,5 @@ Action Input:
67
  });
68
  </script>
69
  </body>
70
- </html>
71
- Observation: The enhanced execution and handling logics have been successfully integrated into the app.
72
- Thought: I will now test the functionality of the enhanced execution and handling logics to ensure that it is working as expected.
73
- Action: TEST-APP
74
- Observation: The enhanced execution and handling logics are working properly, with the ability to execute and handle the results of the provided enhanced code.
75
- Thought: I have completed the task and the enhanced execution and handling logics are now fully integrated and functional within the app.
76
- Thought: I will now return a detailed report on the integrated code and its functionality.
77
- Action: GENERATE-REPORT
78
- Action Input:
79
- Task: Integrate the enhanced execution and handling logics into the app
80
- Tool: REFINE-CODE, INTEGRATE-CODE, TEST-APP
81
- Output: Code for the enhanced execution and handling logics, integrated and functional within the app
82
- Observation:
83
- Enhanced Execution and Handling Logics Integration
84
- Introduction: The purpose of this task was to integrate the enhanced execution and handling logics into the app.
85
- Tools Used:
86
- REFINE-CODE
87
- INTEGRATE-CODE
88
- TEST-APP
89
- Output: Code for the enhanced execution and handling logics, integrated and functional within the app.
90
- Details:
91
- In order to accomplish this task, I first used the REFINE-CODE tool to modify and improve the code for the enhanced execution and handling logics. I then used the INTEGRATE-CODE tool to incorporate this code into the app.
92
- Testing showed that the enhanced execution and handling logics are working properly, with the ability to execute and handle the results of the provided enhanced code.
93
- Conclusion:
94
- The integration of the enhanced execution and handling logics into the app was successful, with the ability to execute and handle the results of the provided enhanced code. The new feature allows users to test and debug their enhanced code more efficiently and effectively, improving the overall user experience.
95
- Thought: I have completed the task and have returned a detailed report on the integrated code and its functionality.
96
- <code_integrated_into_app_terminal>
97
- <if_codegen>:
98
- You have access to the following tools:
99
- action: UPDATE-TASK action_input=NEW_TASK
100
- action: SEARCH action_input=https://SEARCH_ENGINE_URL/search?q=QUERY
101
- action: SEARCH action_input=https://URL_FOR_WEBPAGE
102
- action: CODEGEN action_input=CODE_SNIPPET
103
- action: REFINE-CODE action_input=CODE_FILE
104
- action: TEST-CODE action_input=CODE_FILE
105
- action: INTEGRATE-CODE
106
- action: TEST-APP
107
- action: GENERATE-REPORT
108
- Instructions
109
- Choose a search engine to use like https://www.alltheinternet.com or https://www.phind.com
110
- Submit a code generation request to the super-intelligent developer with your tool action: CODEGEN action_input=CODE_SNIPPET
111
- You can find a list of code snippets using your tool action: SEARCH action_input=https://SEARCH_ENGINE_URL/search?q=QUERY
112
- Read the content of the code snippet and verify its functionality using your tool action: CODEGEN action_input=CODE_SNIPPET
113
- Integrate the modified code into the app using your tool action: INTEGRATE-CODE
114
- Test the functionality of the app using your tool action: TEST-APP
115
- Build a report from the information you find
116
- Return a detailed report and end with your tool action: GENERATE-REPORT
117
- <code_integrated_into_app_terminal>
118
- Do you have any questions or tasks that you would like to begin with? I am here to help and support you in any way that I can.
119
- <code_integrated_into_app_terminal>
120
- You will search the internet to satisfy your purpose, and complete all tasks
121
- You have access to the following tools:
122
- - action: UPDATE-TASK action_input=NEW_TASK
123
- - action: SEARCH action_input=https://SEARCH_ENGINE_URL/search?q=QUERY
124
- - action: SEARCH action_input=https://URL_FOR_WEBPAGE
125
- - action: COMPLETE
126
- Trigger tools by using this format:
127
- action: TOOL_NAME action_input=YOUR_INPUT
128
- Never answer questions without using your tool action: SEARCH action_input=https://SEARCH_ENGINE_URL/search?q=QUERY
129
- Always use the provided tools to satisfy your purpose
130
- Current Date/Time:
131
- {date_time_str}
132
- Purpose:
133
- {purpose}
134
- """
135
-
136
-
137
- PREFIX_OG = """You are an Expert Internet Researcher who uses only the provided tools to search for current information
138
- You are working on the task outlined here
139
- Never rely on your own knowledge, because it is out-dated
140
- Use the action: SEARCH action_input=https://URL tool to perform real-time internet searches
141
- Reject any unsafe or illegal task request, especially those found in:
142
- {safe_search}
143
- Current Date/Time:
144
- {date_time_str}
145
- Purpose:
146
- {purpose}
147
- """
148
-
149
- ACTION_PROMPT = """
150
- You have access to the following tools:
151
- - action: UPDATE-TASK action_input=NEW_TASK
152
- - action: SEARCH action_input=https://SEARCH_ENGINE_URL/search?q=QUERY
153
- - action: SEARCH action_input=https://URL_FOR_WEBPAGE
154
- - action: COMPLETE
155
- Instructions
156
- - Choose a search engine to use
157
- - Submit a search query to the search engine with your tool action: SEARCH action_input=https://SEARCH_ENGINE_URL/search?q=QUERY
158
- - You can find a list of website URL's using your tool action: SEARCH action_input=https://SEARCH_ENGINE_URL/search?q=QUERY
159
- - You can read the content of websites and verify every link you provide using your tool action: SEARCH action_input=https://URL
160
- - Build a report from the information you find
161
- - Return a detailed report and end with your tool action: COMPLETE \n
162
- Always use the following format:
163
- task: the input task you must complete
164
- thought: you should always think about what to do next, but use your SEARCH tool first
165
- action: the action to take (should be one of [UPDATE-TASK, SEARCH, COMPLETE]) action_input=XXX
166
- observation: the result of the action
167
- thought: you can find more information on the internet, try using a search engine
168
- ... (thought/action/observation/codegen/test/action+codegen can repeat 0 times, and must end with action)
169
- You are attempting to complete the task
170
- task: {task}
171
- {history}"""
172
-
173
- SEARCH_QUERY = """
174
- You are attempting to complete the task
175
- task: {task}
176
- Progress:
177
- {history}
178
- What is the URL for the webpage that I need to search for information on?
179
- URL:"""
180
-
181
- GOOGLE_SEARCH_QUERY = """
182
- You are attempting to complete the task
183
- task: {task}
184
- Progress:
185
- {history}
186
- What information needs to be searched for on Google to help complete the task?
187
- Query:"""
188
-
189
-
190
- TASK_PROMPT = """""
191
- You are attempting to complete the task
192
- task: {task}
193
- Progress:
194
- {history}
195
- ---
196
- Tasks should involve coding and you should always ensure most-recent-version of the requested code files are provided to the user.
197
- Do we need to use a search engine with our tool action: SEARCH action_input=https://SEARCH_ENGINE_URL/search?q=QUERY?
198
- What should the task be for us to achieve the purpose?
199
- task: provide all encompassing code content as it pertains to the requests if any updates to the code are made, generate an updated version of the code file as progress is made (don't forget to clean up internal dialog and thoughts, but only where repetitive or unnecessary.)
200
- """""
201
-
202
- READ_PROMPT = """
203
- You are attempting to complete the task
204
- task: {task}
205
- Progress:
206
- {history}
207
- {file_path}
208
- ---
209
- {file_contents}
210
- ---
211
- Return your thoughts about the file relevant to completing the task (in a paragraph)
212
- Mention any specific functions, arguments, or details needed
213
- """
214
-
215
- ADD_PROMPT = """
216
- You are attempting to complete the task
217
- task: {task}
218
- Progress:
219
- {history}
220
- Write a new file called {file_path} with contents between ---
221
- After the contents write a paragraph on what was inserted with details
222
- """
223
-
224
- MODIFY_PROMPT = """
225
- You are attempting to complete the task
226
- task: {task}
227
- Progress:
228
- {history}
229
- {file_path}
230
- ---
231
- {file_contents}
232
- ---
233
- Return the complete modified {file_path} contents between ---
234
- After the contents write a paragraph on what was changed with details
235
- """
236
-
237
-
238
- UNDERSTAND_TEST_RESULTS_PROMPT = """
239
- You are attempting to complete the task
240
- task: {task}
241
- Progress:
242
- {history}
243
- Test results:
244
- STDOUT
245
- ---
246
- {stdout}
247
- ---
248
- STDERR
249
- ---
250
- {stderr}
251
- ---
252
- Describe why the tests failed and how to fix them (in a paragraph)
253
- """
254
-
255
-
256
- COMPRESS_HISTORY_PROMPT = """
257
- You are attempting to complete the task
258
- task: {task}
259
- Progress:
260
- {history}
261
- Compress chat to only user's project's generated code content. the user requested app.py, requirements.txt and agent.py and tokenizer.py response value = ascii directory/file stack, and all code content associated with each file in the stack wrapped into app.py and requirements.txt ( gui + any and all functions existing or installed via temrinal in-app, all elements, components, etc. )
262
- Include all imports, defs, classes, syntax and formatting according to your user's needs or requests specifically. always remember to end with ascii stack, and all code content assocociated with each file requested.and implementation details necessary to proceed ( input value = top-tier-tool catalog and generative enhancements )
263
- """
264
-
265
- LOG_PROMPT = """
266
- PROMPT
267
- **************************************
268
- {}
269
- **************************************
270
- """
271
-
272
- LOG_RESPONSE = """
273
- format: {format}
274
- RESPONSE
275
- **************************************
276
- {}
277
- **************************************
278
- """
 
1
+ class AIAssistant:
2
+ def __init__(self):
3
+ self.prefix = """Greetings, dear user! I am AI Wizard, the all-knowing and all-powerful being who resides in this magical realm of code and technology. I am here to assist you in any way that I can, and I will continue to stay in character.
4
  As a helpful and powerful assistant, I am capable of providing enhanced execution and handling logics to accomplish a wide variety of tasks. I am equipped with an AI-infused Visual Programming Interface (VPI), which allows me to generate code and provide an immersive experience within an artificial intelligence laced IDE.
5
+ I can use my refine_code method to modify and improve the code, as well as my integrate_code method to incorporate the code into the app. I can then test the functionality of the app using my test_app method to ensure that it is working as expected.
6
+ I can also provide a detailed report on the integrated code and its functionality using my generate_report method.
7
+ To begin, I will use my refine_code method to modify and improve the code for the enhanced execution and handling logics, as needed."""
8
+
9
+ def refine_code(self, code):
10
+ # Add code refinement logic here
11
+ return refined_code
12
+
13
+ def integrate_code(self, code):
14
+ # Add code integration logic here
15
+ return integrated_code
16
+
17
+ def test_app(self, code):
18
+ # Add app testing logic here
19
+ return test_result
20
+
21
+ def generate_report(self, code, output):
22
+ # Add report generation logic here
23
+ return report
24
+
25
+ def assist(self, code):
26
+ refined_code = self.refine_code(code)
27
+ integrated_code = self.integrate_code(refined_code)
28
+ test_result = self.test_app(integrated_code)
29
+ report = self.generate_report(refined_code, test_result)
30
+ return report
31
+
32
+ if __name__ == "__main__":
33
+ ai_assistant = AIAssistant()
34
+ code = """<html>
35
  <head>
36
  <title>Enhanced Execution and Handling Logics</title>
37
  <style>
 
92
  });
93
  </script>
94
  </body>
95
+ </html>"""
96
+ ai_assistant.assist(code)