Best way to generate a meta description

what is the best way to create a meta description for a product. The API get the information Product description and a longtext description.
and how can i say the ai that the response, not have more than 160 characters and the sentence is not cut off