fix(router.py): use an older version of async for compatibility

This commit is contained in:
Krrish Dholakia 2023-11-23 21:00:53 -08:00
parent 39072bd196
commit 02464f6661

View file

@ -182,9 +182,7 @@ class Router:
kwargs["original_function"] = self._acompletion
kwargs["num_retries"] = self.num_retries
kwargs.setdefault("metadata", {}).update({"model_group": model})
# Use asyncio.timeout to enforce the timeout
async with asyncio.timeout(self.timeout): # type: ignore
response = await self.async_function_with_fallbacks(**kwargs)
response = await asyncio.wait_for(self.async_function_with_fallbacks(**kwargs), timeout=self.timeout)
return response
except Exception as e: