Best prompt to avoid invalid/undefined values in a JSON response?

I do see the point with the omission from an attention perspective. That said, I do think the approach can have some merits depending on the use case. For instance, I use models quite a bit for classification tasks, drawing from a list of pre-defined categories. In these cases, when reinforcing the instructions by stating it should never deviate in the selection of categories from the pre-defined list, I have historically achieved pretty high success rates.

But I definitely appreciate that in other circumstances it may not have the desired impact.

I guess at the end of the end of the day, prompting really is an art and will always involve a bit of trial and error.