Generation using contrastive search

I want to use “generation.GenerationMixin.contrastive_search” function for my own generative model instead of predefined models.
May i get the demo code to use this function for our own model?
Thanks in advance!