Skip to content

Instantly share code, notes, and snippets.

@emsi
Last active June 16, 2023 12:43
Show Gist options
  • Save emsi/adfb89b836a9e489765032c73d5cdcd0 to your computer and use it in GitHub Desktop.
Save emsi/adfb89b836a9e489765032c73d5cdcd0 to your computer and use it in GitHub Desktop.
GPT Prompting

Well known prompting techniques

  1. Start new conversation for new subject.
  2. Be specific. Provide some context.
  3. If the answer you've got is just bad rather than asking follow up questions it might be better to edit original question to provide more relevant content (or just simply reiterate) rather than continuing. Remember that anything that's in the same conversation influences future answers even further down.
  4. Provide explicite constraints. E.g.: 'Please provide a summary of the following article in 100-150 words, focusing on the main points and conclusions.'
  5. Experiment with different ways of asking. Example: 'Explain the process of photosynthesis in simple terms' instead of 'What is photosynthesis.'
  6. Useing a "system message" at the beginning of your conversation can help set the context for the entire interaction. 'You are an assistant knowledgeable about gardening. Help me understand how to grow tomatoes successfully
  7. Break down complicated tasks or processes into smaller, step-by-step instructions. 'What are the first three steps in building a website from scratch?'
  8. If the initial response from ChatGPT doesn’t quite meet your expectations, don’t hesitate to iterate and refine the response.
  9. Don't hesitate to ask for more or clarify. Keep in mind though that if the conversation gets legthy, especially the smaller GPT-3.5 might struggle to grasp it all.
    • in such case it's better to start new conversation and copy relevant parts as contex
    • or ask GPT to summarize the discution discusion and copy that
    • or copy summary and most relevant parts and the ask followup questions
  10. It's hard to output full book in one shot. If you need more content start with asking for an outline then for each chapter/part prime the model with relevant content and ask to elaborate. Iterate that foreach part and you end up with much bigger output. Watch for repetition though as it migh happend that the same or very similar stuff is repeated in each part.
  11. You may ask to reformat previous answer. "Please summarize you previous answe as bullet points?", or "How would that look like as a Python program instead?"
  12. In case you missed it you can use it as a universal translator too!
  13. IOS ChatGPT app has great dictation with Whisper model. It obliterates everything else on the market (Jun 2023).
  14. It can as as an editor. You may as to change the tone, fix errors or grammar etc.
  15. Fact check the answers you get.
  16. No, seriopusly fact check. Even if you use browser plugin or Bing AI it may hallucinate references it provides. Those references are lireally just one click away.

Less known or niche

  1. Star with asking if he know the subject (it might be good idea to enable browsing plugin). This can be an alternative to providing rich context as the chatbot will provide context himself. For example, start with "Are you familiar with with panel framework?".
  2. You may ask to output PowerPoint presentation, e.g. "Please write a PowerPoint macro that creates a slide deck with...".
    • The input to presentation could be any information discussed previously in the conversation.
    • If he context is too long (and generated code can be lenghty) the quality might be affected.
    • If the code is very long the underlaying engine might use multiple prompts, in such cases the code generated might include extraneous ``` characters to be manualy removed.
  3. Ask for a specifig output form like md file, bullets, CSV, YAML or json.
  4. In you question ask for specific answer structure. If you ask for reasoning first then the final answer and even perhaps a final comments you might get better results (it's in the vein of step-by-step or chain of thought). For example:
Provide response in the following format:

EXPLAIN QUESTION IN YOUR OWN WORDS:
...

REASONING (in points):
1. ...
3. ...
4. ...
etc.

FINAL ANSWER:
YES/NO

COMMENTS:
  1. ...
  2. ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment