Create optimizer object using the tf.keras.optimizers.get function
In order to have a configurable optimizer and configurable hyperparameters for it you need to make the function call in the following way:

opt = tf.keras.optimizers.get({"class_name": hyperparams['optimizer'],
                               "config": {"learning_rate": hyperparams['learning_rate']}})


where class_name is the name of the optimizer you want to use and the config dictionary contains the hyperparameters and their values for the given optimizer.