Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -118,11 +118,17 @@ def call_search(purpose, task, history, directory, action_input):
|
|
| 118 |
except Exception as e:
|
| 119 |
history += "observation: {}'\n".format(e)
|
| 120 |
return "MAIN", None, history, task
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
|
|
|
| 122 |
def call_main(purpose, task, history, directory, action_input):
|
| 123 |
resp = run_gpt(
|
| 124 |
ACTION_PROMPT,
|
| 125 |
-
stop_tokens=["observation:", "task:"],
|
| 126 |
max_tokens=2096,
|
| 127 |
purpose=purpose,
|
| 128 |
task=task,
|
|
@@ -170,16 +176,11 @@ def call_set_task(purpose, task, history, directory, action_input):
|
|
| 170 |
def end_fn(purpose, task, history, directory, action_input):
|
| 171 |
task = "END"
|
| 172 |
return "COMPLETE", "COMPLETE", history, task
|
| 173 |
-
NAME_TO_FUNC = {
|
| 174 |
-
"MAIN": call_main,
|
| 175 |
-
"UPDATE-TASK": call_set_task,
|
| 176 |
-
"SEARCH": call_search,
|
| 177 |
-
"COMPLETE": end_fn,
|
| 178 |
|
| 179 |
-
}
|
| 180 |
|
| 181 |
|
| 182 |
def run_action(purpose, task, history, directory, action_name, action_input):
|
|
|
|
| 183 |
try:
|
| 184 |
if "RESPONSE" in action_name or "COMPLETE" in action_name:
|
| 185 |
action_name="COMPLETE"
|
|
|
|
| 118 |
except Exception as e:
|
| 119 |
history += "observation: {}'\n".format(e)
|
| 120 |
return "MAIN", None, history, task
|
| 121 |
+
NAME_TO_FUNC = {
|
| 122 |
+
"MAIN": call_main,
|
| 123 |
+
"UPDATE-TASK": call_set_task,
|
| 124 |
+
"SEARCH": call_search,
|
| 125 |
+
"COMPLETE": end_fn,
|
| 126 |
|
| 127 |
+
}
|
| 128 |
def call_main(purpose, task, history, directory, action_input):
|
| 129 |
resp = run_gpt(
|
| 130 |
ACTION_PROMPT,
|
| 131 |
+
stop_tokens=["observation:", "task:", "thought:","search:"],
|
| 132 |
max_tokens=2096,
|
| 133 |
purpose=purpose,
|
| 134 |
task=task,
|
|
|
|
| 176 |
def end_fn(purpose, task, history, directory, action_input):
|
| 177 |
task = "END"
|
| 178 |
return "COMPLETE", "COMPLETE", history, task
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
|
|
|
|
| 180 |
|
| 181 |
|
| 182 |
def run_action(purpose, task, history, directory, action_name, action_input):
|
| 183 |
+
print(f'action_name::{action_name}')
|
| 184 |
try:
|
| 185 |
if "RESPONSE" in action_name or "COMPLETE" in action_name:
|
| 186 |
action_name="COMPLETE"
|