Thanks for the reply, I have looked into that and as I am fairly new to this I would like to ask you if what I have in mind is true or not. Here what I think could work
class PrecisionMacro(tf.keras.metrics.Metric):

  def __init__(self, name='precision_m', **kwargs):
    super(PrecisionMacro, self).__init__(name=name, **kwargs)
    self.precision= np.asarray(1,)

  def update_state(self, y_true, y_pred, sample_weight=None):
    y_true_array = tf.make_ndarray(y_true)
    y_pred_array = tf.make_ndarray(y_pred)

    self.precision = precision_score(y_true_array, y_pred_array)

  def result(self):
    return self.precision

Thanks