Enable multiple llms

This commit is contained in:
Niels Geens
2024-11-22 15:05:54 +01:00
parent bbb88f39e8
commit 8766a945c0
28 changed files with 972 additions and 525 deletions

8
sia/web/util.py Normal file
View File

@@ -0,0 +1,8 @@
import asyncio
def wrap_async(coro_func):
"""Wraps an async callback to be safely called from another thread."""
loop = asyncio.get_event_loop()
def wrapper(*args, **kwargs):
loop.call_soon_threadsafe(lambda: asyncio.create_task(coro_func(*args, **kwargs)))
return wrapper