async def aretry_request(
    request_func: Callable[..., Any], max_retries: int = 10, *args: Any, **kwargs: Any
) -> Any:
    """
    Retry a request function asynchronously.

    Args:
        request_func (Callable[..., Any]): The request function.
        max_retries (int): The maximum number of retries.
        *args (Any): The positional arguments.
        **kwargs (Any): The keyword arguments.

    Returns:
        Any: The response.

    """
    retry_decorator = create_retry_decorator(max_retries)

    @retry_decorator
    async def retry_func(
        request_func: Callable[..., Any], *args: Any, **kwargs: Any
    ) -> Any:
        if iscoroutinefunction(request_func):
            return await request_func(*args, **kwargs)
        else:
            return request_func(*args, **kwargs)

    return await retry_func(request_func, *args, **kwargs)

    Retry a request function asynchronously.

    Args:
        request_func (Callable[..., Any]): The request function.
        max_retries (int): The maximum number of retries.
        *args (Any): The positional arguments.
        **kwargs (Any): The keyword arguments.

    Returns:
        Any: The response.

    
llama-index-integrations/llms/llama-index-llms-deepinfra/llama_index/llms/deepinfra/utils.py