ragas
ragas copied to clipboard
Chore: Fix RuntimeError: ... got Future <..> attached to a different loop
In issue #963 I commented about the RuntimeError when trying to use TestsetGenerator.
In issue #681 you discussed that using get_event_loop() was the optimal way to solve the issue but it had a Deprecation warning.
In newer python versions get_event_loop() raises a RuntimeError when no event loop is active. Thus we can avoid creating unnecessary new loops that seem to be the problem that was mentioned in both issues.
I have modified the code the least possible to make it clear what I intended to, although in this setup runner could be avoided as was proposed in #689
Setup: Ragas version: 0.1.7 Python version: Python 3.10.13