Moved network retry handling into get_prediction