Find answers from the community

Updated 3 months ago

I have created a custom node_

I have created a custom node_postprocessor and passed it as an argument in the Query engine as -
query_engine = RetrieverQueryEngine.from_args(retriever, node_postprocessors=[postprocessor])
however, while doing query to the engine I am getting this error -
RuntimeError Traceback (most recent call last)
<ipython-input-51-cc65093c9740> in <cell line: 1>()
----> 1 response = query_engine.query(
2 "is sarthak a good boy"
3 )

22 frames
/usr/lib/python3.10/asyncio/runners.py in run(main, debug)
31 """
32 if events._get_running_loop() is not None:
---> 33 raise RuntimeError(
34 "asyncio.run() cannot be called from a running event loop")
35

RuntimeError: asyncio.run() cannot be called from a running event loop
s
L
6 comments
can you share the code fragment you tried this with?
there seems to be some problematic code somewhere.
Just need to add to your code

Plain Text
import nest_asyncio
nest_asyncio.apply()
ok that works too.
my original idea was creating async tasks in the current event loop if exists otherwise create a new one. then wait and fetch the results.
I think it will still be an issue, anytime you are using asyncio.run() in a running event loop πŸ€”
Add a reply
Sign up and join the conversation on Discord