Find answers from the community

Updated 6 months ago

One other issue I'm noticing after

At a glance

The community member is experiencing an issue with the asyncio.run() function after migrating to version 0.10.X, which was not present in version 0.9.X. The community members suggest using nest_asyncio.apply() to resolve the issue, but this causes another error when used in a Django application. The community members also note that the issue only occurs when setting use_async=True in the from_vector_store method, and that using use_async=False resolves the problem. However, the community members are unsure why this issue only occurs in version 0.10.X and not in previous versions.

One other issue I'm noticing after migration to 0.10.X is that I get this error asyncio.run() cannot be called from a running event loop in my API call. This wasna't the case during 0.9.X. I wasn't using nestio previously too.
L
c
8 comments
Something must be nested async in the features you are using πŸ€·β€β™‚οΈ Just add

Plain Text
import nest_asyncio
nest_asyncio.apply()
I didn't need to use nest_asyncio previously in 0.9.X
Is this something I apply in the API?
I'm using Django btw.
after some more digging without using nest_asyncio.apply()
interestingly, I noticed this error pops up only if I kept use_async True in the from_vector_store method
Plain Text
vector_store = QdrantVectorStore(
                aclient=aclient,
                collection_name=QDRANT_CLOUD_COLLECTION_NAME
            )
base_index = VectorStoreIndex.from_vector_store(
                vector_store=vector_store,
                embed_model=embeddings,
                callback_manager=callback_manager,
                use_async=True
            )

if I remove it it works.
I'm already using use_async=True in query engines and stuff but those don't raise error. This only happens on 0.10.X
is there any idea as to why that is the case?
Yes -- that will cause the embeddings to be calculated with multiple async requests. Maybe this feature wasn't working properly in a past version and is now fixed
yea nest_asyncio.apply() is just something I would throw into the top of my file
i see. Yeah I tried doing nest_asyncio.apply() in my django request but it ended up giving the error that it cannot patch a uvloop :/
I know fastapi let's you set the loop type to asyncio. Not sure if Django has a similar option
Add a reply
Sign up and join the conversation on Discord