Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

RuntimeError: asyncio.run() cannot be called from a running event loop #138

Answered by SeeknnDestroy
andysingal asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @andysingal

Thank you for using autollm and for reporting this issue.

The error is due to the attempt to start an async uvicorn server in Google Colab, which already runs in an async event loop. To resolve this, use nest_asyncio to patch the event loop. Here’s the code snippet you can use:

!pip install nest_asyncio
import nest_asyncio
from autoLm import AutoFastAPI

nest_asyncio.apply()
app = AutoFastAPI.from_query_engine(query_engine)

# Now you can run the app without the RuntimeError
uvicorn.run(app, host="0.0.0.0", port=8000)

We hope this helps, and we’re here for any further questions or feedback.

Best,
Talha

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fcakyon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #134 on November 08, 2023 05:57.