A short course on deeplearning.ai, taught by Andrew Ng and Isa Fulford.
ChatGPT Prompt Engineering for Developers - DeepLearning.AI
https://github.com/dinhanhthi/note-chatgpt-prompt-engineering-for-developers
Two types of LLMs (Large Language Models):
In this course, we focus on Instruction Tuned LLM.
<aside> ☝ Sometimes, if LLM doesn’t work, it’s just because your instruction isn’t clear enough!
</aside>
👉 OpenAI API 📙 Notebook.
Two principles:
Tactic 1. Use delimiters to clearly indicate distinct parts of the input: """
, `````, ---
, <>
, <tag></tag>
(xml tags)
prompt = f"""
Summarize the text delimited by triple backticks \\
into a single sentence.
```{text}```
"""
Tactic 2. Ask for a structured output: JSON, HTML
prompt = f"""
Generate a list of three made-up book titles along with their authors and genres.
Provide them in JSON format with the following keys:
book_id, title, author, genre.
"""
Tactic 3. Ask the model to check whether conditions are satisfied → check assumptions required to do the task → how the model should handle the edge case to avoid unexpected errors or result.
prompt = f"""
You will be provided with text delimited by triple quotes.
If it contains a sequence of instructions, re-write those instructions in
the following format:
Step 1 - ...
Step 2 - …
…
Step N - …
If the text does not contain a sequence of instructions, then simply write
\\"No steps provided.\\"
\\"\\"\\"{text_1}\\"\\"\\"
"""