How do i get reliably structured answers from gpt-3 according to a given scheme?

Asking

{model: text-davinci-003, prompt: generate 5 quiz questions with one correct and 3 incorrect answers each about wines . All quiz questions should be formatted as follows (without numbering) in CSV format ‘question;correct answer;wrong answer;wrong answer;wrong answer###’, temperature: 0.7, max_tokens: 2000, frequency_penalty: 2, n: 1}

I get

What color is a dry red wine?;Red;Yellow;Green;Blue###What is the name of the southernmost wine-growing town in Germany?;Freinsheim (Rhineland-Palatinate);Frankfurt (Hesse);Berlin (Brandenburg);Munich (Bavaria)###What grape is used to make champagne? ;Chardonnay, Pinot Meunier and Pinot Noir ;Sauvignon Blanc, Riesling and Gewürztraminer ;Merlot, Cabernet Sauvignon and Syrah/Shiraz ;Malbec, Carmenère and Tempranillo###What is an Appellation d’origine contrôlée(AOC)? A certification process for wines in France;A tax on the sale of wine in Europe. A category of high quality Italian wines.;A quality label on which the origin of the wine is displayed.###Which country represented the largest share of world wine consumption in 2019 ? France;;Italy;;Spain;;USA

How do I get GPT-3 to always comply with the specifications?

A couple of things to consider in your prompt:

  • use the word form of number for example five questions sometimes it gives you better results.
  • start your prompt like you are giving instructions. for example Generate 5 quiz questions following these INSTRUCTIONs: and then gives your instructions in new lines for example: MUST have one correct and 3 incorrect answers\n...
  • do your instructions in upper-case letters, sometimes it gives better results
    Hope this was helpful :slightly_smiling_face:
2 Likes