Skip to main content

Prompt Engineering Checklist

IDTactic Description
Tactic_001Separate input parts with markers ( back tick, """, < >, <tag> </tag>, :)
Tactic_002Insruct LLM for a structured/formated output (JSON, HTML, etc.)
Tactic_003Conditional model instructions (if question contains...)
Tactic_004"Few-shot" prompting (provide examples of desired behavior)
Tactic_005Specify steps to complete a tasks
Tactic_006Instruct the model to work out its own solution before rushing to a conclusion
Tactic_T007Translate (between languages, define language, formal & informal, business). Spellchecks
Tactic_T008Summarization (text, topics, emotions, attributes, etc)

Promt Tactics

T_001: Separate input parts with markers

  • Delimiters can be anything like: ```, """, < >, <tag> </tag>, :
  • Helps to avoid prompt injections
    Example:
text = f""" Text to be summarized."""

prompt = f""" Summarize the text delimited by triple backticks ```{text}``` """

T_002: Insruct LLM for a structured/formated output

  • for example (JSON, HTML, etc.)

Example:


prompt = f""" Generate a list of three made-up movies (titles only) \
with their 3 main actors and genres.
Provide them in JSON format with the following keys:
book_id, title, author, genre.
"""

T_003: Conditional model instructions

Example:

text_1 = f""" text, which has instructions
"""
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}\"\"\"
"""

T_004: "Few-shot" prompting

  • providing LLM examples will ameliorate it performance

Example:

prompt = f"""Your task is to answer in a consistent style.

<child>: Teach me about patience.

<grandparent>: Patience involves accepting and tolerating delays or setbacks without getting frustrated or angry. Cultivating patience requires mindfulness, accepting what you can't control, and understanding that progress is often gradual

<child>: Teach me about resilience.
"""

T_005: Specify steps to complete a tasks

Example:

prompt_2 = f"""
Your task is to perform the following actions:
1 - Provide summarized description for contries provided in text delimited by <> with 1 sentence
2 - Translate Country names into French, German & Belarusian
3 - Output a json array of objects, where each object contains following keys: original_counry_name, french_name, german_name, belarusian_name, summary.

Use the following format:
Countries: <list of countries in original language>
Output JSON: <json with original_counry_name, french_name, german_name, belarusian_name, summary firelds >
Text: <{text}>
"""

T_006: Ask the model to work out its own slution then before rushing to a conclusion

TBD Example:

prompt = f"""
Your task is to determine if the student's solution \
is correct or not.
To solve the problem do the following:
- First, work out your own solution to the problem including the final total.
- Then compare your solution to the student's solution \
and evaluate if the student's solution is correct or not.
Don't decide if the student's solution is correct until
you have done the problem yourself.

Use the following format:
- Question:
- Sudent answer
- Actula Solution
- Is the student's solution the same as actual solution: yes not no
"""

T_007: Transform/Translate (between languages, define language, formal & informal tones, stellcheck)

Define & Translate between languages

The technics can be used

  • to translate between to specific languages Translate the following English text to Spanish: \
  • to define which language it is Tell me which language this is:
  • to translate to multiple languages Translate the following text to French and Spanish:\
  • to translate in formal & informal Translate the following text to Spanish in both the \ formal and informal forms:
  • to translate multiple messages in different languages into english for support team Translate the following text to English \

Tone Transformation

Example:

prompt = f"""
Translate the following from slang to a business letter:
'Dude, This is Joe, check out this spec on this standing lamp.'
"""

Format Conversion

Convert data between different formats

Example:

prompt = f"""
Translate the following python dictionary from JSON to an HTML \
table with column headers and title: {data_json}
"""

Spellcheck/Grammar check

  • proofread and correct prompt = f"proofread and correct this review: ```{text}```"
  • advance reader Ensure it follows APA style guide and targets an advanced reader

T_008: Summarization

  • Shorten text within desired word/sentence/character limit in at most 30 words
  • Summarize with a focus on specific attributes in at most 30 words, and focusing on any aspects that mention shipping and delivery of the product.
  • Try "extract" instead of "summarize" extract the information relevant to A and B
  • Identify types of emotions Identify a list of emotions (at msot 5) that the writer of the review is expressing.
  • Identify emotion (anger) Is the writer of the following review expressing anger?
  • Extract attributes Identify the following items from the review: item name, company that made the item
  • Determine topics in input text Determine five topics that are being discussed in the text