Update generate_predictions to use latest API. Needs unit tests.