Can't seem to eliminate markdown format

Another way to get outputs to conform to a specific format without prompting with lots of prohibitions is to employ a few-shot prompt.

Few-shot prompting is when you include several examples of input/output, or even just examples of output as part of your prompt. I usually include an additional message at the end of my instructions with something like:

Examples:
### Prompt: What are the store hours on weekends?
### HTML Response:
<p>Our store hours on weekends are from 9:00 AM to 9:00 PM.</p>

### Prompt: Do you carry gluten-free bread?
### HTML Response:
<p>Yes, we carry a variety of gluten-free breads. Please visit our bakery section.</p>

### Prompt: Can you tell me the price of organic bananas?
### HTML Response:
<p>The price of organic bananas is $0.99 per pound.</p>

### Prompt: Is there a discount on dairy products this week?
### HTML Response:
<p>Yes, we have a 15% discount on all dairy products this week. Visit our dairy section for more details.</p>

### Prompt: Tell me the ingredients in this pet food.
### HTML Response:
<ul>
  <li>Chicken meal</li>
  <li>Brown rice</li>
  <li>Barley</li>
  <li>Oats</li>
  <li>Pea protein</li>
</ul>

and then the model will take that as a queue for how it should answer using HTML. I didn’t write this few-shot prompt, I actually had gpt-4 generate this prompt, asking it to help me write a few-shot prompt for a grocery store helper bot with the example being a question/answer pair involving petfood like you included.

1 Like