Omnibus commited on
Commit
eb03447
·
verified ·
1 Parent(s): b56eef2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -229,7 +229,7 @@ def compress_history(purpose, task, history):
229
  def call_main(purpose, task, history, action_input):
230
  resp = run_gpt(
231
  FINDER,
232
- stop_tokens=["observation:", "task:","action:"],
233
  max_tokens=2096,
234
  seed=random.randint(1,1000000000),
235
  purpose=purpose,
@@ -243,10 +243,11 @@ def call_main(purpose, task, history, action_input):
243
  continue
244
  if line.startswith("thought: "):
245
  history += "{}\n".format(line)
 
246
  if line.startswith("action: "):
247
  action_name, action_input = parse_action(line)
248
  print(f'ACTION::{action_name} -- INPUT :: {action_input}')
249
- history += "{}\n".format(line)
250
  return action_name, action_input, history, task
251
  else:
252
  pass
@@ -330,14 +331,14 @@ def find_all(purpose,task,history, url):
330
  print (f'out:: {out}')
331
  history += "observation: the search results are:\n {}\n".format(out)
332
  task = "compile report"
333
- return "UPDATE-TASK", None, history, task
334
  else:
335
- history += "observation: I need to trigger a search using the following syntax:\naction: SCRAPE_WEBSITE action_input=URL\n"
336
- return "UPDATE-TASK", None, history, task
337
  except Exception as e:
338
  print (e)
339
  history += "observation: I need to trigger a search using the following syntax:\naction: SCRAPE_WEBSITE action_input=URL\n"
340
- return "UPDATE-TASK", None, history, task
341
 
342
  #else:
343
  # history = "observation: The search query I used did not return a valid response"
 
229
  def call_main(purpose, task, history, action_input):
230
  resp = run_gpt(
231
  FINDER,
232
+ stop_tokens=["observation:", "task:"],
233
  max_tokens=2096,
234
  seed=random.randint(1,1000000000),
235
  purpose=purpose,
 
243
  continue
244
  if line.startswith("thought: "):
245
  history += "{}\n".format(line)
246
+
247
  if line.startswith("action: "):
248
  action_name, action_input = parse_action(line)
249
  print(f'ACTION::{action_name} -- INPUT :: {action_input}')
250
+ #history += "{}\n".format(line)
251
  return action_name, action_input, history, task
252
  else:
253
  pass
 
331
  print (f'out:: {out}')
332
  history += "observation: the search results are:\n {}\n".format(out)
333
  task = "compile report"
334
+ return "MAIN", None, history, task
335
  else:
336
+ history += "observation: An Error occured\nI need to trigger a search using the following syntax:\naction: SCRAPE_WEBSITE action_input=URL\n"
337
+ return "MAIN", None, history, task
338
  except Exception as e:
339
  print (e)
340
  history += "observation: I need to trigger a search using the following syntax:\naction: SCRAPE_WEBSITE action_input=URL\n"
341
+ return "MAIN", None, history, task
342
 
343
  #else:
344
  # history = "observation: The search query I used did not return a valid response"