fix(router.py): speed improvements to the router

This commit is contained in:
Krrish Dholakia 2023-11-27 17:35:02 -08:00
parent 8560794963
commit 04f745e314
4 changed files with 92 additions and 5 deletions

View file

@ -178,7 +178,7 @@ async def acompletion(*args, **kwargs):
response = completion(*args, **kwargs)
else:
# Await normally
init_response = completion(*args, **kwargs)
init_response = await loop.run_in_executor(None, func_with_context)
if isinstance(init_response, dict) or isinstance(init_response, ModelResponse): ## CACHING SCENARIO
response = init_response
elif asyncio.iscoroutine(init_response):