Skip to content

'This event loop is already running' error when using LiteLLM inside another event loop #1647

@martinscooper

Description

@martinscooper

LiteLLMInferenceEngine, as it is implemented on unitxt, creates an event loop. FastAPI/Jupyter Notebooks also create one. asyncio doesn't allow nested loop, so we need to rely on nest_asyncio to handle them.

We should catch this error and add an error message with instructions and suggested fix

Refer to this discussion for more details.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions