|
| 1 | +import concurrent.futures |
1 | 2 | import gc
|
2 | 3 | import json
|
3 | 4 | import os
|
@@ -364,14 +365,14 @@ async def chatbot(q: Q):
|
364 | 365 | )
|
365 | 366 | else:
|
366 | 367 | q.client.query = question
|
367 |
| - llm_response, alt_response, err = ask( |
368 |
| - question=q.client.query, |
369 |
| - sample_queries_path=q.user.sample_qna_path, |
370 |
| - table_info_path=q.user.table_info_path, |
371 |
| - table_name=q.user.table_name, |
372 |
| - model_name=q.user.model_choice_dropdown, |
373 |
| - debug_mode=q.args.debug_mode |
374 |
| - ) |
| 368 | + with concurrent.futures.ThreadPoolExecutor() as pool: |
| 369 | + llm_response, alt_response, err = await q.exec(pool, ask, question=q.client.query, |
| 370 | + sample_queries_path=q.user.sample_qna_path, |
| 371 | + table_info_path=q.user.table_info_path, |
| 372 | + table_name=q.user.table_name, |
| 373 | + model_name=q.user.model_choice_dropdown, |
| 374 | + debug_mode=q.args.debug_mode |
| 375 | + ) |
375 | 376 | llm_response = "\n".join(llm_response)
|
376 | 377 | except (MemoryError, RuntimeError) as e:
|
377 | 378 | logging.error(f"Something went wrong while generating response: {e}")
|
|
0 commit comments