Zihao Wang commited on
Commit
36a72e1
1 Parent(s): 725388b

timeout setting

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -142,7 +142,7 @@ def split_draft(draft, split_char = '\n\n'):
142
  # print(f"The draft answer has {len(draft_paragraphs)}")
143
  return draft_paragraphs
144
 
145
- def split_draft_openai(question, answer, NUM_PARAGRAPHS = 3):
146
  split_prompt = f'''
147
  Split the answer of the question into multiple paragraphs with each paragraph containing a complete thought.
148
  The answer should be splited into less than {NUM_PARAGRAPHS} paragraphs.
@@ -349,7 +349,7 @@ def rat(question):
349
 
350
  # query = get_query(question, answer)
351
  print(f"{datetime.now()} [INFO] Generating query ...")
352
- res = run_with_timeout(get_query_wrapper, 10, question, answer)
353
  if not res:
354
  print(f"{datetime.now()} [INFO] Generating query timeout, skipping...")
355
  continue
@@ -359,7 +359,7 @@ def rat(question):
359
 
360
  print(f"{datetime.now()} [INFO] Crawling network pages ...")
361
  # content = get_content(query)
362
- res = run_with_timeout(get_content_wrapper, 10, query)
363
  if not res:
364
  print(f"{datetime.now()} [INFO] Parsing network pages timeout, skipping ...")
365
  continue
@@ -372,7 +372,7 @@ def rat(question):
372
  break
373
  print(f"{datetime.now()} [INFO] Revising answers with retrieved network pages...[{j}/{min(len(content),LIMIT)}]")
374
  # answer = get_revise_answer(question, answer, c)
375
- res = run_with_timeout(get_revise_answer_wrapper, 15, question, answer, c)
376
  if not res:
377
  print(f"{datetime.now()} [INFO] Revising answers timeout, skipping ...")
378
  continue
 
142
  # print(f"The draft answer has {len(draft_paragraphs)}")
143
  return draft_paragraphs
144
 
145
+ def split_draft_openai(question, answer, NUM_PARAGRAPHS = 4):
146
  split_prompt = f'''
147
  Split the answer of the question into multiple paragraphs with each paragraph containing a complete thought.
148
  The answer should be splited into less than {NUM_PARAGRAPHS} paragraphs.
 
349
 
350
  # query = get_query(question, answer)
351
  print(f"{datetime.now()} [INFO] Generating query ...")
352
+ res = run_with_timeout(get_query_wrapper, 30, question, answer)
353
  if not res:
354
  print(f"{datetime.now()} [INFO] Generating query timeout, skipping...")
355
  continue
 
359
 
360
  print(f"{datetime.now()} [INFO] Crawling network pages ...")
361
  # content = get_content(query)
362
+ res = run_with_timeout(get_content_wrapper, 30, query)
363
  if not res:
364
  print(f"{datetime.now()} [INFO] Parsing network pages timeout, skipping ...")
365
  continue
 
372
  break
373
  print(f"{datetime.now()} [INFO] Revising answers with retrieved network pages...[{j}/{min(len(content),LIMIT)}]")
374
  # answer = get_revise_answer(question, answer, c)
375
+ res = run_with_timeout(get_revise_answer_wrapper, 30, question, answer, c)
376
  if not res:
377
  print(f"{datetime.now()} [INFO] Revising answers timeout, skipping ...")
378
  continue