Phoenix21 commited on
Commit
293bf44
·
verified ·
1 Parent(s): a5cb58f

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +4 -2
pipeline.py CHANGED
@@ -200,9 +200,11 @@ async def run_async_pipeline(query: str) -> str:
200
  return final_refusal.strip()
201
 
202
  # Run the pipeline with the event loop
 
 
203
  def run_with_chain(query: str) -> str:
204
- loop = asyncio.get_event_loop()
205
- return loop.run_until_complete(run_async_pipeline(query))
206
 
207
  # Initialize chains here
208
  classification_chain = get_classification_chain()
 
200
  return final_refusal.strip()
201
 
202
  # Run the pipeline with the event loop
203
+ import asyncio
204
+
205
  def run_with_chain(query: str) -> str:
206
+ # Use asyncio.run to run the async pipeline, which ensures a fresh event loop
207
+ return asyncio.run(run_async_pipeline(query))
208
 
209
  # Initialize chains here
210
  classification_chain = get_classification_chain()