Hello Olivier,
This would look as follow:

# Train a model
model = tfdf.keras.GradientBoostedTreesModel()
model.fit(...)

# Extract trees from the model.
inspector = model.make_inspector()
all_trees = inspector.extract_all_trees()

# Create a new model with only the first 5 trees.
num_extracted_trees = 5
pruned_model_path = "/tmp/pruned_model"
assert num_extracted_trees < inspector.num_trees()

builder = tfdf.builder.GradientBoostedTreeBuilder(
  path = pruned_model_path, ...)
for tree in all_trees[:num_extracted_trees]:
    builder.add_tree(tree)
builder.close()

# Load and evaluate the new model
pruned_model = tf.keras.models.load_model(pruned_model_path)
pruned_model.compile(metrics=[tf.keras.metrics.AUC(curve='PR')])
pruned_evaluation = pruned_model.evaluate(test_ds, return_dict=True)

This notebook 2 is a working example. It evaluates the PR-AUC vs the number of trees.
Cheers,
Mathieu