mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
Use AsyncRetry in acompletion_with_retries
This commit is contained in:
parent
4a6dcd64ff
commit
1a68e15430
1 changed files with 2 additions and 2 deletions
|
@ -3191,13 +3191,13 @@ async def acompletion_with_retries(*args, **kwargs):
|
||||||
retry_strategy = kwargs.pop("retry_strategy", "constant_retry")
|
retry_strategy = kwargs.pop("retry_strategy", "constant_retry")
|
||||||
original_function = kwargs.pop("original_function", completion)
|
original_function = kwargs.pop("original_function", completion)
|
||||||
if retry_strategy == "exponential_backoff_retry":
|
if retry_strategy == "exponential_backoff_retry":
|
||||||
retryer = tenacity.Retrying(
|
retryer = tenacity.AsyncRetrying(
|
||||||
wait=tenacity.wait_exponential(multiplier=1, max=10),
|
wait=tenacity.wait_exponential(multiplier=1, max=10),
|
||||||
stop=tenacity.stop_after_attempt(num_retries),
|
stop=tenacity.stop_after_attempt(num_retries),
|
||||||
reraise=True,
|
reraise=True,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
retryer = tenacity.Retrying(
|
retryer = tenacity.AsyncRetrying(
|
||||||
stop=tenacity.stop_after_attempt(num_retries), reraise=True
|
stop=tenacity.stop_after_attempt(num_retries), reraise=True
|
||||||
)
|
)
|
||||||
return await retryer(original_function, *args, **kwargs)
|
return await retryer(original_function, *args, **kwargs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue