Note: Help not needed anymore, leaving here for others' referenceI'm trying to use the PGVectorStore with async, and am starting it in an async method itself, which raises
RuntimeError: asyncio.run() cannot be called from a running event loop
sys:1: RuntimeWarning: coroutine 'VectorStoreIndex._async_add_nodes_to_index' was never awaited
sys:1: RuntimeWarning: coroutine 'run_async_tasks.<locals>._gather' was never awaited
This is occurring because the library defines a function
run_async_tasks
that... runs async tasks with
asyncio.run()
directly. The easy fix is to import nest_asyncio and monkeypatch asyncio. Personally, this hurts, knowing that under the hood, it's running a blocking operation by creating a new event loop :(